Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

Certificate Validation Error When Invoking Azure Cognitive Search API

We have an ASP.Net MVC application that invokes the Azure Cognitive Search API to execute a search. The application is deployed in an Azure VM running IIS. When the ACS API is invoked we are getting the following error:

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) --- End of inner exception stack trace ---

If I invoke the ACS API from an Azure developer VM in the same subnet via Postman it works fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Problem

It's possible you are running an old OS image or have Windows Update disabled on your VM which prevents the latest intermediate and root certificate authorities from updating.

Solution

Run Windows Update on your VM, or use the latest Azure VM OS image.

You can verify if you have the latest intermediate certificate authorities by checking the cert store on the VM. Specifically, you're looking for "Microsoft Azure TLS Issuing CA 01" which is the intermediate cert authority Azure Cognitive Search and most Azure services are using.

Manage User Certificates -> Intermediate Certification Authorities -> Certificates -> "Microsoft Azure TLS Issuing CA 01"

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...