0

Upload file fails while I try to upload from company network to Azure IoT Hub. Network team suggested to go through another proxy. Implemented proxy as mention in below code but doubt that this code is not respecting proxy settings and upload still fails. Am I missing anything here?

var conSettings = new Http1TransportSettings
{                
    Proxy = new System.Net.WebProxy {
        UseDefaultCredentials = true,
        Address = new Uri("http://proxy.com:1234"),
        BypassProxyOnLocal = true            
    }                
};            

using(var deviceClient = DeviceClient.CreateFromConnectionString(conString, "xxx:xxx:xxx:xxx", new ITransportSettings[] { conSettings }))
using(var sourceData = new FileStream(file, FileMode.Open))
{
    await deviceClient.UploadToBlobAsync(fileName, sourceData);
}

How to ensure that this code is making request using given proxy settings?

Vipul
  • 1,563
  • 4
  • 22
  • 46
  • 1
    The actual upload to blob happens through the Azure Storage SDK (behind the scenes of UploadToBlobAsync()). Not sure if this is respecting the proxy. If you do not get an answer here, I'd recommend to open an issue at https://github.com/Azure/azure-iot-sdk-csharp/issues – silent Feb 20 '19 at 08:18
  • 1
    have a look at my answer in the https://stackoverflow.com/questions/46520282/azure-iot-sdk-upload-blob-metadata, try to use a REST APIs for uploading blob based on the Azure IoT Hub references. – Roman Kiss Feb 20 '19 at 10:15

0 Answers0