IotHubClientTransportSettings.Proxy Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The web proxy that will be used to connect to IoT hub using a web socket connection for AMQP, MQTT, or when using the HTTP protocol.
public System.Net.IWebProxy Proxy { get; set; }
member this.Proxy : System.Net.IWebProxy with get, set
Public Property Proxy As IWebProxy
Property Value
Examples
To set a proxy you must instantiate an instance of the WebProxy class--or any class that derives from IWebProxy.
The snippet below shows a method that returns a device using a proxy that connects to localhost on port 8888.
IotHubDeviceClient GetDeviceClient()
{
var proxy = new WebProxy("localhost", "8888");
var mqttSettings = new IotHubClientMqttSettings(IotHubClientTransportProtocol.WebSocket)
{
// Specify the WebProxy to be used for the connection
Proxy = proxy,
};
var fileUploadSettings = new IotHubClientHttpSettings
{
// Also configure the proxy for file uploads.
Proxy = proxy,
};
var options = new IotHubClientOptions(mqttSettings)
{
FileUploadTransportSettings = fileUploadSettings,
};
return new IotHubDeviceClient("a connection string", options);
}
Remarks
If you wish to bypass OS-specified proxy settings, set this to GetEmptyWebProxy().
Applies to
Azure SDK for .NET
الملاحظات
https://aka.ms/ContentUserFeedback.
قريبًا: خلال عام 2024، سنتخلص تدريجيًا من GitHub Issues بوصفها آلية إرسال ملاحظات للمحتوى ونستبدلها بنظام ملاحظات جديد. لمزيد من المعلومات، راجعإرسال الملاحظات وعرضها المتعلقة بـ