SSL Connection / Connection Reset with IISExpress

2020-01-24 10:43发布

I'm using the new Visual Studio 2013 with IISExpress for the first time (previously used ASP.net Development server on VS2010). I'm running into issues trying to debug my project.

This is what I see in Chrome:

Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have. Error code: ERR_SSL_PROTOCOL_ERROR

I updated my Properies -> web file so that the Project Url uses a https URL now. However, after doing that, I now get a new error when launching:

The connection to localhost was interrupted. Error code: ERR_CONNECTION_RESET

Thanks

19条回答
The star\"
2楼-- · 2020-01-24 11:10

The problem that I was experiencing had to do with me, at some point in time, enabling HSTS for localhost and not realizing that this would break my http://localhost:someport in IIS Express.

HSTS tells the browser (Chrome in my case) to ALWAYS request a URL using HTTPS. So therefor even though I hadnt even enabled SSL for my MVC 5 app, the browser would still try to access my site using HTTPS in the URL instead of HTTP.

The fix?

  1. Surf to chrome://net-internals/#hsts
  2. In the delete section, enter "localhost" and delete the record from Chrome.
查看更多
男人必须洒脱
3楼-- · 2020-01-24 11:10

I'd just rebuilt my computer. This thread gave me the clues, where I realized in the project settings>Web, the project was configured to use HTTP and the HTTP port. By updating it to HTTPS and the correct HTTPS port, everything started to work again.

查看更多
Evening l夕情丶
4楼-- · 2020-01-24 11:12

None of the above options worked for me. I had to do the following:

  1. Uninstalled IIS Express 8.0
  2. Deleted all the configurations in my Documents directory for IIS Express
  3. Reinstalled IIS Express 8.0
  4. Deleted the project on my local machine and downloaded a clean version for TFS
  5. Ran the project - it then ran over SSL and I am able to debug

I got the steps from this thread.

Hope this helps.

查看更多
混吃等死
5楼-- · 2020-01-24 11:15

Removing IISExpress and vs directories and using ssl port range of 44300 to 44399 (inclusive) from this article worked for me

查看更多
▲ chillily
6楼-- · 2020-01-24 11:17

This is anecdotal as overheard from a co-worker, but allegedly this is an issue with chrome forcing https. I usually launch in firefox so i hadn't seen this problem before. Using firefox or ie worked for my co-worker.

查看更多
倾城 Initia
7楼-- · 2020-01-24 11:17

In my case, the localhost url was redirected to https://localhost when I was debugging. This happened from one moment to other, without changing anything. I solved this by making a hard reload to the browser. Here the link

查看更多
登录 后发表回答