IIS Express Visual Studio - Cannot debug localhost - debugging

Been trying to resolve this issue for a few days now. I've done a ton of searching and tried several solutions - nothing has helped thus far.
I have a Visual Studio 2017 project. It has been running and debugging fine for years now. Suddenly, the other day I can no longer debug the application. Regardless of what browser I select (IE, Edge, Chrome, Firefox, etc) - the same error message is generated:
INET_E_RESOURCE_NOT_FOUND
Also, it takes forever for VS to open the browser to show this message. Additionally, if I start without debugging (ctrl + F5), the site works and loads as expected.
Things I've tried thus far:
Deleting everything from the IIS Express folder in My Documents
Re-installing IIS Express
Repairing IIS
Changing the port number in the project
Various IIS Express reset commands
Resetting IE settings
Clearing caches
There are probably a few others too, but at this point I feel I've exhausted all my options.
Anyone else encounter this and if so how did you fix it?

Thank you for the tip #Fletch Zhou.
Turns out the issue was a corruption in IIS (and likely its certificates). I was able to fix it by following the instructions found here:
Visual Studio 2017 Removing SSL/TLS Connections Problems with IIS Express
One quick note: for projects that already have SSL Enabled set to True, simply toggle the flag and Visual Studio will assign a new SSL port number.
Hope this helps someone else. I know I was frustrated having not made any changes and suddenly I cannot locally debug projects.
More Info: I attempted to debug an application I'd run several times after performing the steps listed in the linked article from PluralSight (tried that several times to ensure I wasn't missing anything). The symptom re-appeared- any browser would indicate the page didn't exist. I noticed that IIS Express was not running - didn't open at all; or at least not noticeably. I unchecked the "Enable Edit and Continue" option as discussed in this post: IIS Express Immediately Shutting Down Running Site after Stopping Web Application. Though the symptoms didn't match exactly, it was a simple-enough option to try. Sure enough, the site was operational once again. I'm running Visual Studio 2017 Version 15.6.4. Not sure if this is related to Visual Studio or IIS Express, but unchecking the "Enable Edit and Continue" seemed to resolve the latest hang up.

I had to set my start page to Default.aspx again. I don't know how it got unset or why it would result in that INET_E_RESOURCE_NOT_FOUND error.

Related

"Unable to Launch the IIS Express Web Server" (UseIIS vs. UseIISExpress)

Using Visual Studio 2012, suddenly we are getting the error "Unable to Launch the IIS Express Web Server" and the answer is NOT to change the port number, so please don't suggest that. The answer is also NOT to delete the IIS Express folder or the applicationHost.config file ... none of those solutions worked. The only thing that could get any of the programs to run is changing "UseIIS" to false in the .csproj file, while keeping "UseIISExpress" set to true.
<UseIISExpress>true</UseIISExpress>
<UseIIS>False</UseIIS>
If I flip them (UseIIS=true and UseIISExpress=false) it will not run, same error. On a co-worker's PC both values are set to true and that person does not have any issues with running projects. What could be causing this inconsistency and how can we fix this so that we don't have to edit every single .csproj file to get programs to run? We work with over 100 programs so this isn't ideal.
It is hard to pinpoint the problem directly according to an error message. We have to try every solution to troubleshoot it.
This kind of issue happens frequently on the Win7 machine with VS2012.
Lots of people post questions pertaining to this issue on SO, We have to find which solution is appropriate for us.
Unable to launch the IIS Express Web server
On my side, I choose to repair it and run VS with the Administrator account again. It worked perfectly.
Feel free to let me know if there is anything I can help with.

Visual Studio Debugging is stuck at "Attaching to the web server"

When I run my Web API application I get the following window:
It just stays like that indefinantly, until I hit cancel.
When I do hit cancel, this error message is shown:
I have tried rebooting, and running iisreset /restart but it does not fix it.
Any ideas what I can do to get my debugger working again?
NOTE: My Web API 2 project's Servers setting is set to Local IIS. My service is hosted by IIS and when I am not debugging, it works fine.
A possible fix:
Check the "Enable Just My Code" in Tools->Options->Debug
I just did a reset for all the settings for VS and it worked again.
Tools => Import and Export Settings => Reset All Settings
good luck!
I had this issue for Visual Studio 2017 and like with the previous post I had Debugging option "Enable .NET Framework source stepping" ticked. Un-ticking fixed the issue.
So as I commented before I had this same issue, but I now figured out the cause and have a solution.
I just got a new machine last week (this issue was actually one of the reasons why) and after a while I had the same issues, not being able to debug my projects. Luckily because I was installing all the updates one by one I was able to pin-point when it started happening.
It seems the latest update for the "Microsoft ASP.NET and Web Tools" extension breaks something.
Sadly, uninstalling or reverting the Web Tools extension is not easy: Remove this extension by going to the Windows control panel and modifying your Visual Studio installation. I had to remove Visual Studio completely and reinstall it (repair didn't do the trick).
You can update and install all your extensions as you wish, just make sure that you don't update the Web Tools extension
I tested this on my old machine and it did the trick there as well.
I've also created an Issue on GitHub as I won't be updating the extension until this is fixed, if anybody has additional information please add it to the Issue.
In Visual Studio 2015, go to Tools -> Options -> Debugging and deselect "Enable .NET Framework source stepping". This may relate to an issue with loading symbols, so if you want to keep the ability to debug .NET Framework source, then it may help to search the web for how to clear the symbol cache, or preload it, or set your symbol server, and so on.
In Visual Studio 2017, I just restarted my machine and ran the solution, no other windows opened not even a browser, although visual studio took a long time to open (30+ projects in a solution) the problem did not reoccur.
I had the same issue in VS 2017 and un-checking 'Native code' did the trick. Not sure why it was checked.
In my case I set Debugging ->Symbols -> To "Load Only Specified Modules" to include the symbols for, in my case a devops symbols feed for some internal NuGet packages
Options>Debugging>Symbols>Load Only Specified Modules
By checking the option "Always load symbols where located next to modules" the setting won't mess with the regular/classic debugging in VS for your own code
This way the Symbols are still loading where needed and Visual Studio is not trying to load debugging information for all the IIS .net dlls that were loaded by w3wp
Alternatively it can also be configured to not load symbols for microsoft.*.dll and it will also work.
Didn't see this in the current answers, so thought I'd give my 2 cents in 2022:
What worked for me:
Make sure to check that your IIS application pool hasn't been stopped (and restart it if it is), and then if that's not the case, restart your IIS server.
If you don't where those settings are, open our Internet Information Services (IIS) Manager, Application Pools are in the left-hand column, and restart/start/stop your server is in the right column.

Visual Studio 2010 hangs when opening websites

My Visual Studio 2010 Professional hangs up 99.999% of the time when I try to open a website as "Remote Site" through an HTTP address. However if i open the site through a unc path instead of through HTTP, it works fine. Of course that is not always feasible, for example when working from offsite. The same sites (assuming they are not NET40 sites) work fine in Visual Studio 2008, so I'm pretty sure it is not a problem with the Front Page Server Extensions.
If i run 2010 in /safe mode, it opens the projects fine. So i figured maybe it was one of my installed extensions. I therefore disabled all my extensions and tried again, but it still hangs up. So it is apparently something in Visual Studio itself that is different between safe and normal modes.
I ran it in logging mode, and checked the log but did not see anything that stuck out to me. The log is uploaded here: http://pastebin.com/aUnVanB1 .
The exact symptoms I am seeing are that when i click on the project name, it pops up and asks me for my credentials. I enter those, and click OK, and it then loads the solution explorer, and i see the tree view, but then it just hangs with the progress dialog that says "Preparing Solution...". The progress bar keeps cycling, but it never finishes loading, and the spot where the properties window would be in the VS UI is completely unpainted, with just a blank, empty, white space.
Any one have any clue what else i could do to try to figure out why 2010 hangs when attempting to load websites via HTTP? Thanks!
Thanks for your question... you gave me the right clue to solve my problem!
My VS 2010 was hanging (in fact was very slow to get available) when I was openening a solution containing a remote website and I was due to press Escape a few times to cancel the pending operation... As you suggest I tried to open such a solution with /safeMode and VS2010 became available quite instantly.
So as you pointed the VS Extensions... I checked mine (all from Telerik): opening the extension manager I discovered that some updates where available. I thought the extensions updates were automatically proposed and so never checked that before. In fact, you need to manually check with the extension manager if some are available.
I've updated all my Telerik extensions... and now I may open normally all solutions including a remote website.
Thanks a lot! Perhaps... you need to updates your extensions???
Check you network order preference in Windows.
I had a similar problem where DNS would cause a hang of 1 minute before trying again (and again and finally on the next network).
Under Network, Advanced Settings (WinXP):

Breakpoints not working in Visual Studio 2008

When I hit F5, my VS 2008 opens my site in IE and halts. There is no sign in VS that the project is running. It enables the RUN button again even though the site is opened in IE. Hence, my breakpoints are also not working.
This behaviour started happening suddenly..
Any reasons why it happens and resolutions?
Are you building in Debug mode? Release builds don't support breakpoints...
One reason I have personally experienced:
Problem:
Running two separate Solutions in their own instance of Visual Studio 2008
Solution:
I closed both instances of VS, then started only one.
Conclusion 1:
Visual Studio might have a problem when RAM is limited and silently disable breakpoints (fail)
Conclusion 2:
Visual Studio might share some critical resources needed for breakpointing which the first instance holds onto and (again silently) the other instance won't even give you an error.
Lots of bugs and fail in Visual Studio.
This is a bit late, but in case anyone else has this problem, I'll post these two links that helped me when I had a similar problem:
Forum describing similar problems: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/f3fcb4fb-8a08-4fa0-8d58-9ed6f3eb1193
Solution listed in the forum was this patch: http://code.msdn.microsoft.com/KB957912/Release/ProjectReleases.aspx?ReleaseId=1796

Visual Studio detaches from application as soon as debugging starts

I have a web application that I've always been able to run in Visual Studio and it debugs just fine (breakpoints work, I can pause execution, etc). Recently, the behavior changed suddenly, and a few things happen:
I start debugging, it lauches IE and loads the application, but after a few seconds (sometimes the page hasn't even displayed yet), Visual Studio acts as if debugging has stopped - I'm able to edit code in VS again, and the "Play" button on the toolbar is enabled. The application continues to run in the IE window just spawned, but I'm not attached to it
During this few seconds that VS is "debugging", because it detaches, my breakpoints show as hollow - as if I'm set to "Release" mode and they won't be hit. In fact, I have a breakpoint set in Page_Load, and it skips right by. I've checked, and I'm set to debug mode, though the compile mode dropdown is missing from my toolbar (I checked in the build properties to ensure I was in debug mode).
Can anybody shed some light here?
It turns out that this was actually a result of an upgrade to Windows Vista. VS wasn't being "Run as an Administrator", which caused it to lack the rights to attach to other processes for debugging. As a result, debugging would stop right after it started. Changing the VS shortcut to run as an administrator resolved this problem.
I've experienced samely looking behavior. The cause was in existence of several <system.web> sections (which is allowed by web.config schema). Visual Studio debugger (versions 2008 and 2010 were tested) looks in the first encountered section only. So if your <compilation debug="true"> tag is not in the first one, it thinks that there are no compilation.debug setting present and genrally tryes to add <compilation debug="true"> to the first <system.web>. In some cases VS2008 just silently procceds in this case. For example look here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=510354#details"
Have you installed anything else on the server / workstation recently?
We have a third party app that doesn't allow us to debug, w3wp.exe crashes immediately upon an attempt to debug.
I ran into something similar when I had placed some code in a constructor that was crashing. Exact same issues where the Debug would disconnect just after the application started up.
The short if it, check that you haven't configured a class constructor to run during web startup that is crashing...
Quick windows 7 update: I had to add "localhost" to my list of trusted sites to correct this issue...go figure.
Just a workaround for those (like me) for whom the above solutions do not work: After starting the app you wish to debug, go to Debug -> Attach to Process, and attach it to the process you want to debug. Works on my machine.
In my case, I faced this issue with Visual Studio 2019 and 2022 as well.
I tried upgrading/downgrading Visual Studio versions but nothing helped.
On debugging, I finally found the root cause and sharing it here to help others facing the same problem.
I was using Brave browser with Visual Studio and whenever I uploaded a file in my application, the Visual Studio debugging stopped automatically. The root cause of this issue is the feature in Visual Studio to stop debugging on closing the browser. With Brave browser Visual Studio feels like we have closed the browser on uploading the file. So to fix this issue I have turned of this setting as given here.
You can find this setting here
Tools > Options > Projects and Solutions > Web Projects > Stop debugger when browser window is closed, close browser when debugging stops
Just turn it off and everything should work fine.

Resources