IotHubServiceClientOptions.Proxy プロパティ

定義

HTTP プロトコルを使用するときに IoT ハブへの接続に使用される Web プロキシ。

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

プロパティ値

プロキシを設定するには、 クラスの WebProxy インスタンスまたは から IWebProxy派生した任意のクラスをインスタンス化する必要があります。 次のスニペットは、ポート 8888 で localhost に接続するプロキシを使用してデバイスを返すメソッドを示しています。 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); }

注釈

OS で指定されたプロキシ設定をバイパスする場合は、これを に設定します GetEmptyWebProxy()

適用対象