I have a Web App that in one of it's processes needs to call a https web service in an external server.
When I make the call I get a this exception: An error occurred while making the HTTP request to https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
An error occurred while making the HTTP request to https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
The inner exception is: The underlying connection was closed: An unexpected error occurred on a send.
In order to debug, I created a windows form application that used exactly the same code and did exactly the same call, and accessed the same certificate for the call. But on the windows form application the call goes through without a problem.
I'm at a loss as to what could be causing the connection to fail from inside IIS and don't know what could be different between the two.
I identified the problem and managed to find a solution.
The problem was that the code was using a certificate that the logged user had access to but IIS didn't. In order to install the certificate in a way that IIS has access to it you need to:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.