Comments (8)
Hi @arturl . See the changes here for enabling UploadToBlobAsync in UWP:
9983d01
This is going into the master branch soon.
Thanks!
from azure-iot-sdk-csharp.
I try this solution but I have this error:
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
from azure-iot-sdk-csharp.
Hello @pandazzurro,
Thanks for trying it. Are you trying my branch or the master one? This isn't on the master branch nor nugget package yet.
If you are using my branch can you detail a bit more what is the line and class it is failing?
Thanks
from azure-iot-sdk-csharp.
Hi @sergaz-msft,
I commit project:
https://github.com/pandazzurro/IoTHubUWP
I use your branch.
public async void Run(IBackgroundTaskInstance taskInstance)
{
var deferral = taskInstance.GetDeferral();
try
{
string myConnectionDevice = "myconn";
DeviceClient client = DeviceClient.CreateFromConnectionString(myConnectionDevice);
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write("CiaoSonoUnMessaggio");
writer.Flush();
stream.Position = 0;
await client.UploadToBlobAsync("demo", stream);
}
catch (Exception ex)
{
var a = ex;
}
}
await client.UploadToBlobAsync("demo", stream); break
Thanks
from azure-iot-sdk-csharp.
Hi @pandazzurro ,
Instead of creating the stream can you try using it like on our sample?
public async Task UploadFile(Windows.Storage.StorageFile file)
{
var fileName = file.Name;
using (Windows.Storage.Streams.IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
await deviceClient.UploadToBlobAsync(fileName, stream.AsStream());
}
You need to use Windows.Storage.Streams since this is a UWP app.
Also you can now use the master branch, that already has the changes.
5357642
from azure-iot-sdk-csharp.
Hi @sergaz-msft,
I updated my project with master dll file.
I have created one project with IoT template and one project with UWP template.
I have same error.
Task.Run(async () =>
{
string myConnectionDevice = "HostName=gabp2017.azure-devices.net;DeviceId=TestDevice;SharedAccessKey=blablabla=";
DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(myConnectionDevice);
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Images/GAB.png"));
var fileName = file.Name;
using (Windows.Storage.Streams.IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
await deviceClient.UploadToBlobAsync(fileName, stream.AsStream());
}).Wait();
Do you think that the error is the connectionString?
Thanks
from azure-iot-sdk-csharp.
Hi @sergaz-msft,
Now work for me.
I must unlink blob account from IoTHub, then I link it again.
ConnectionString is the same but now it work!
Great! 👍
Good Job!
You save my session in Global Azure Bootcamp
from azure-iot-sdk-csharp.
Glad that you made it @pandazzurro :). You shouldn't need to relink the Azure Blob in the Portal unless it had a TTL.
Good luck with the Global Azure Bootcamp :).
All Best
from azure-iot-sdk-csharp.
Related Issues (20)
- After Creating Edge Device returned device ETag includes double quotes
- [Technical Question] How to use Device Registration Status Lookup API HOT 2
- Not able to restart the custom edge module while using the inbuilt "RestartModule" direct method of $edgeAgent from custom iot edge module. HOT 14
- How can parent child relationship be established between Iotdevices without utilizing azure Iotedge ?? HOT 2
- Json Format Exception to get payload from Direct Method Request and Twin Json Wrongly formatted
- [Bug Report] Cannot invoke direct methods with payload in IotEdge devices. HOT 8
- [Bug Report] [v2] [IoTSDK] ModuleClient.SendMessageToRoute() not firing IncomingMessageCallback when routing M2M
- IoT Edge not connecting to IOT Hub HOT 2
- Route data directly from opc publisher to rabbit mq is possible? HOT 2
- [Technical Question] [v2] How to set Properties on TelemetryMessage HOT 1
- [Bug Report] Upgrade dependency on Microsoft.Rest.ClientRuntime to Azure.Core HOT 2
- Microsoft.Azure.Devices.Client v1.42.0 has indirect security vulnerabilies HOT 3
- AOT-compatible Microsoft.Azure.Devices.Client HOT 1
- SDK version :2.0.0-preview007 CreateAsync() Json Error
- [Bug Report] WebSockets not working on Web Assembly HOT 1
- Latest device client does not connect over MQTT HOT 9
- Errors while running e2e tests with .NET 8.0 HOT 1
- How to use tpm private key for TLS with IoT Hub SDK (Not TPM Attestation) - for DeviceAuthenticationWithX509Certificate HOT 4
- [Bug Report] AMQP DeviceClient is slow to respond to device being disabled
- Desired Properties callback not triggering after a reconnect HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-iot-sdk-csharp.