ProvisioningClientTransportSettings.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 or MQTT 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.
ProvisioningDeviceClient GetProvisioningDeviceClient()
{
var proxy = new WebProxy("localhost", "8888");
var mqttSettings = new ProvisioningClientMqttSettings()
{
Proxy = proxy
};
var optionsWithProxy = new ProvisioningClientOptions(mqttSettings);
return new ProvisioningDeviceClient(
"global endpoint",
"your id scope",
securityProvider,
optionsWithProxy);
}
Remarks
If you wish to bypass OS-specified proxy settings, set this to GetEmptyWebProxy().
Applies to
Azure SDK for .NET