简体   繁体   中英

IIS refuses connection when debugging with Visual Studio

I need to do some work on a legacy(ish) ASP.NET MVC app. First time I've ever worked in the Microsoft/.NET environment.

When I launched the app through IIS Express using Visual Studio's default Debug profile, IIS Express would not respond to my http request. Chrome gave me an ERR_CONNECTION_REFUSED message.

Thinking this was an IIS Express specific error, I switched development to IIS 10. However, IIS 10 exhibits the same problem, among other issues. When I make a request from Firefox, I'm given a 401. When I make an https request from Chrome, I receive an ERR_CONNECTION_REFUSED message (just like IIS Express). When I make an http request from Chrome, the WindowsAuthentication_OnAuthenticate method in my MyApplication : HttpApplication is called, then I get a 302 redirect to the same page over https, then I receive an ERR_CONNECTION_REFUSED message.

I've read other SO questions about similar IIS issues, and I've tried what they suggested to the best of my knowledge. First, (with Visual Studio closed) I deleted the .vs folder in my solution's folder. Then I reopened Visual Studio with elevated privileges, and reopened my solution to regenerate the .vs folder. Then, I opened my project's properties and manually clicked the button to create a virtual directory for my IIS 10 deploy. I also (attempted) to stop Chrome from automatically redirecting localhost to https, and then repeated all the previous steps. None of this helped any.

I'm using Visual Studio 2019 on Windows 10 Home edition. The only binding I have in IIS 10 is the default http binding to port 80 for all (*) IP addresses. I think I'm using .NET 4, but maybe I'm using ASP.NET 4? Honestly not sure.

Any advice?

Lex Li's comment (give him upvotes) showed me what I had done wrong. My IIS 10 install didn't come with any default binding for https. So every time I was redirected to https (I think my app was automatically doing this?), IIS didn't know how to handle that https request, and therefore refused to connect. Once I opened up my IIS Manager and added a https binding for port 443 (for all IP addresses), then I was able to access my website normally.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM