証明書が無効であるというエラーが発生する理由を誰かに教えてもらえますか? PowerShell
で、私はInvoke-WebRequest
のIPアドレスを使用し、証明書のCNと一致するようにホストヘッダーを設定すると、私はcertエラーを取得しません。私はHttpClient
は同じだろうと思いますか?HttpClient証明書のエラー
var spHandler = new HttpClientHandler();
var spClient = new HttpClient(spHandler);
spClient.BaseAddress = new Uri("https://10.0.0.24");
var spRequest = new HttpRequestMessage(HttpMethod.Get, "/api/controller/");
spRequest.Headers.Host = "somehost.com";
var spResponse = await spClient.SendAsync(spRequest);
エラー:
WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
AuthenticationException: The remote certificate is invalid according to the validation procedure.
このコードは、モニタユーティリティの一部であり、我々は、ロードバランサの背後にある各Webフロントエンドを探査することができるようにする必要があります。私たちはこれをPowerShellで多く行いました。私は証明書と一致するようにHostヘッダーを設定している限り、この問題は見たことがありません。