IotHubServiceClientOptions.Proxy プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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()。
適用対象
Azure SDK for .NET