问题
I am using Visual Studio 2008, and I had an ASP.NET dev configuration working fine, but today when I try to launch any ASP.NET project within the development web server, the browser opens, but I get an error Can't establish a connection to localhost:64428
(port varying at each attempt).
The problem is happening even with a newly created Web Application.
When I try to add a break point the C# code file associated to the default page, I get a warning that The breakpoint will not currently be hit. No symbols have been loaded for this document.
I guess that I have managed to break the configuration of my local ASP.NET development web server. Does anyone know how to fix such a situation?
回答1:
I found one potential solution here:
http://www.grumpydev.com/2009/03/12/strange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost/comment-page-1/#comment-73
In summary, edit your hosts file to include:
127.0.0.1 localhost
Not sure how mine got changed or if it even being changed was the cause of the problem, but I'm good to go now since adding the above entry and commenting out the "::1" entry.
回答2:
I've ran into this before and would start with a couple of things.
In the tray, verify there is no asp.net web server running. If so, stop it so it will restart when you launch the app from VS.
I've seen the 'no breakpoint' error when the application has been copied or not opened properly, whether it be from a change in IIS or something. Try opening the project at a file level or web level (whichever is different from what you're doing) and see if that corrects the problem. That will help you isolate what's going on there. You may need to try opening the csproj file rather than the sln file to isolate if there is an invalid reference in the sln file.
You may want to debug and do an 'Attach to process'. That will also help determine what's going on AND give you the ability to debug it.
来源:https://stackoverflow.com/questions/650735/cant-establish-connection-on-local-asp-net-development-web-server