当我尝试从公司网络上传到Azure IoT中心时,上传文件失败。网络团队建议通过另一个代理。如以下代码中所述实现了代理,但是怀疑此代码不遵守代理设置,并且上传仍然失败。我在这里想念什么吗?
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);
}
如何确保此代码使用给定的代理设置发出请求?