Home > Enterprise >  IIS 2019: The request was aborted: Could not create SSL/TLS secure channel
IIS 2019: The request was aborted: Could not create SSL/TLS secure channel

Time:02-14

I've seen others post similar issues and go down the route of using the following code snippet

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | 
                                                   SecurityProtocolType.Tls11 |
                                                   SecurityProtocolType.Tls12 | 

However, I'm still having issues with the following scenario.

I have a Web App running on IIS on Windows Server (An EC2 Instance Win 2019 Server) and a Microservice running on Kestrel. If I RDP to the Win Server and open up Chrome/Firefox/Edge I can navigate to the micro-service, make a basic API call and see data come back. However, when the IIS application tries to access the the API I get the following error in my logs

      InnerException:
        >       Type:       HttpRequestException
        >       Message:    An error occurred while sending the request.
        >       Data:       0 entries
        >       Stack trace:
              ----------------
              InnerException:

                      Type:       WebException
                      Message:    The request was aborted: Could not create SSL/TLS secure >channel.
                      Data:       0 entries
                      Stack trace:
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
                        InnerException is null

The certificate is valid/trusted/secured. So there's no issue there.

I'm assuming that when the request goes from the Web App in IIS and tries to reach out to the API, it doesn't like something? Is there a way to get further info on why I'm getting the exception(s)

CodePudding user response:

Looks like this was the answer https://trailheadtechnology.com/solving-could-not-create-ssl-tls-secure-channel-error-in-net-4-6-x/

I hope this saves someone some time and headaches

  • Related