Compartir a través de


IotHubServiceClientOptions.Proxy Propiedad

Definición

Proxy web que se usará para conectarse a IoT Hub al usar el protocolo HTTP.

public System.Net.IWebProxy Proxy { get; set; }
member this.Proxy : System.Net.IWebProxy with get, set
Public Property Proxy As IWebProxy

Valor de propiedad

Ejemplos

Para establecer un proxy, debe crear una instancia de la WebProxy clase o cualquier clase que derive de IWebProxy. El fragmento de código siguiente muestra un método que devuelve un dispositivo mediante un proxy que se conecta a localhost en el puerto 8888. IotHubServiceClient GetServiceClient() { var proxy = new WebProxy("localhost", "8888"); var options = new IotHubServiceClientOptions { Protocol = IotHubTransportProtocol.WebSocket, // Specify the WebProxy to be used for the HTTP and web socket connections. Proxy = proxy, // Using the default HttpClient here, so the proxy for HTTP operations will be set for me. }; return new IotHubServiceClient("a connection string", options); }

Comentarios

Si desea omitir la configuración de proxy especificada por el sistema operativo, establezca esta GetEmptyWebProxy()opción en .

Se aplica a