问题
I have a asp.net mvc website developed in .NET framework 4.7. getting connection issue from hosted website. can you please help
An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
回答1:
I usually face this error while debugging, but if you deploy this it will disappear.
For debugging purpose, add following lines before calling external services. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
来源:https://stackoverflow.com/questions/61202514/connection-issue-to-azure-cognitive-search-from-asp-net-mvc-website