ASP.NET Development Server Restart EVERY Time - visual-studio

If I make a change in my ASP.NET project using VS2008 or VS2010, I must stop the ASP.NET development server and restart it (usually by "View in Browser") to see the change reflected.
I'm having the exact same problem as this guy:
ASP.net development server needs restart every time
Except for me, his solution doesn't work: adding/changing the registry value at HKLM\Software\Microsoft\ASP.NET\FCNMode to 0 or 2 does nothing that I can see.
Now the crazy part -- I just upgraded to VS2010 assuming all of my problems would be solved. I migrated my project to .NET 4.0 and did my "View in Browser" only for the exact same behavior to occur! 4.0 runs a completely different version of WebDev.WebServer, I thought for sure this would solve my issue! Nope.
THEN I read about IIS Developer Express, just being released with WebMatrix, and I find how to get my website to load (command prompt) only for, you guessed it, the same issue to happen. I have to kill the server and restart for my changes to be seen.
And the changes I'm talking about don't have to be code updates, they could be a simple HTML modification. The server isn't recognizing the change and thus isn't serving me the new page. CSS or JS files can be updated and seen without restart.
I'm just looking for some ideas as to what could be the problem. Thoughts, please!?
Workstation: Win7 64-bit, VS2008 and VS2010.

So the answer was with the FCNMode, but on Windows 7 64-bit the registry location is different, HKLM/Software/Wow6432Node/Microsoft/ASP.Net
I changed the FCNMode setting from 1 to 2 and without rebooting loaded everything up just fine.
Thanks to Brian over at the ASP.NET Forums for the solution!
http://forums.asp.net/p/1516728/4017980.aspx#4017980

I generally avoid using Cassini and configure my projects to use IIS 7 instead. Any reason why you can't use IIS directly?

Related

Default ASP.NET Core MVC project won't run

I created a new ASP.NET Core MVC project with Visual Studio 2019, using the built in default template. I simply ran the project by clicking the green 'play' arrow where it says "IIS Express" (or by pressing F5). I haven't modified anything, yet when my browser opens up (in this case, Microsoft Edge) I get this:
Can’t connect securely to this page
This might be because the site uses outdated or unsafe TLS security settings. If this keeps happening, try contacting the website’s owner.
Your TLS security settings aren’t set to the defaults, which could also be causing this error.
I've opened a 'ticket' with Microsoft, but haven't heard anything yet. It may be that there is an issue with my IIS Express installation, but I'm not sure how to figure that out. I normally prefer to run my ASP.NET MVC local development from my local IIS, but it seems that IIS Express is the default way for Core MVC.
I modified my install of Visual Studio 2019 by removing all the web (ASP.NET) components, and then modified it again by adding them. After this, the default ASP.NET Core project does indeed work and debug with IIS Express.
I don't know how my install became corrupted, but it must have been from one of the numerous Visual Studio updates that seem to be released every few days.

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.

"Process with an Id of #### is not running" in Visual Studio

I am trying to run any program on visual studio 2013 update 3 and I get the following alert box:
Process with an Id of #### is not running.
Every time there is different ID number showing.
and in the error windows, I get this error message:
The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.
Sometimes it runs and in the browser I get the following message:
The webpage is not available.
Why is this occurring and how can I resolve it?
The following steps fix the problem for me:
Close Visual Studio
Navigate to the folder where your solution files are stored and delete the hidden .vs folder.
Restart Visual Studio
Hit F5 and IIS Express should load as normal, allowing you to debug.
Note: Based on my experience and others in the comments, this problem seems to be caused by moving a project between workstations, environments, or versions of Visual Studio. There must be some environment specific information contained in the .vs folder.
Open Visual Studio as an administrator
Right-click your project and click on 'Unload Project'
Again, right-click your project and click on 'Edit PROJECT_NAME.csproj'
Find the code below and delete it:
<DevelopmentServerPort>63366</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:63366/</IISUrl>
Save and close the file .csproj
Right-click your project and reload it
First Error
For the first error:
Process with an ID #### is not running.
The following steps worked for me:
Close all instances of Visual Studio.
Rename the IISExpress folder (in my PC is in C:\Users\jmelosegui\Documents).
Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1.
Start Visual Studio in administrator mode. (In Windows, right click the executable file and select Run as administrator).
Second Error
The second error:
The webpage is not available
What caused this error:
I deleted IIS Express Development Certificate while playing with the SSL.
The following steps worked for me:
Go to Control Panel.
Select Add/Remove Programs.
Locate IIS 8.0 Express.
Right click on it then click Repair.
Your certificate should be back!
With respect to the first error:
Process with an ID #### is not running
This situation will sometimes occur when IIS Express fails to bind to a port. A likely reason for that is that some other process has already bound to that port. Visual Studio will launch the IISExpress.exe process (which will fail to bind to the port and exit again) and then attach to the now-terminated process, resulting in the above error.
To check, note the port number in your project settings (e.g. 12116) and then try:
netstat -ano | find "12116"
If another process has the port open, this will give its PID. You can then choose to kill the offending process or reallocate your own port number.
If you are using a 64-bit machine
Then the problem maybe due to Visual Studio use of 32-bit IIS-Express.
Solution: In Visual Studio, go to Tools menu > Options > Projects and Solutions > Web Projects > Enable the option "Use the 64 bit version of IIS Express" and click ok
I had the same problem. Just restarting Visual Studio worked for me.
My fix was simple, I was missing prerequisites. I needed to install .NET Core SDK
Kilanny's answer is correct. Most machines in 2015 are 64bit, so there's a lot of chances that you just need to enable the 64bit option under the Tools main navigation link menu. No need to configure other files or hard code ports. Besides, port assignment should be dynamic. This fix applies to 2013 With Update 3 and Visual Studio 2015 Community Edition.
Check the images below for a mini tutorial:
(I'm just improving Kilanny's answer)
It looks like there are many solutions that work and some that don't...
My issue kept surfacing after a few test iterations.
Yes restarting the PC and/or VS would resolve the issue...but temporarily.
My solution was to undo a security change I had enabled a couple days
earlier to Controlled folder access under Ransomware protection.
I undid this change by:
(right click Start)
Setting->Update & Security->Windows Security->Virus & threat protection-> Virus & threat protection settings->Manage settings
Under Controlled folder access
Click->Manage Controlled folder access
(this is also the Ransomware protection screen)
Turn Controlled folder access off.
This was 100% the issue for me as I was able to run my test without restarting VS.
Another reason this can happen is for a .NET Core Web app if you upgrade the Microsoft.AspNetCore.Components.* NuGet package to a new version but don't install the new SDK,
In my case it was upgrading Microsoft.AspNetCore.Components.WebAssembly from 6.0.0 to 6.0.1 and didn't install .NET 6.0.1 SDK
go to Properties of the start up project, increment port number of the Project Url is probably the quickest way to get around this problem which I didn't read anyone mentioned yet.
And you don't need to restart VS as it can be a pain sometimes if you needed a few other instances needed to be running.
My solution to this on a new machine and fresh install of VS 2022 was to install the 3.1 framework. So check to make sure whatever framework the project is expecting is installed on your local machine.
I had a similar problem with Chrome. It appears that VS can't attach to the Chrome process for some reason.
Solution:
Close Chrome
With Chrome closed, start the web project and allow VS to open Chrome.
For me, none of the other solutions worked.
The things I tried:
Updating and patching everything associated with Visual Studio
Reinstalling Visual Studio
Reinstalling IIS Express
Several reboots
Adding the _WORKAROUND thing to the PATH
Renaming the IIS folder under documents to regenerate the IIS config
Manually editing the csproj file and removing the whole IIS settings section
Changing the IIS executable usage to 64bit in VS settings
Changing the port of IIS in the projects settings
After checking if the problem was persistent over different projects, it turned out that the problem only occurred in one specific projects. I figured that I had to delete all the user specific files in the solutions folder (such as bin, obj, *.suo, ...)
I just deleted the whole solution folder and reverted the files in git.
TLDR:
Try deleting user specific files/folders like bin, obj, *.suo, ...
Reboot your computer before trying any of these!
Some of these may be helpful. Doing the netstat trick
netstat -ano | find
helped me as another application was using my port, but didn't completely solve my problem. IIS Express still kept crashing. It wasn't until I rebooted my win 10 PC (first time in over a week), that my problem completely cleared up.
Head to the following directory
%userprofile%\documents\IISExpress\Config directory
Delete all files within that folder. Restart visual studio and works like a charm.
I had the same problem, and what needed to be done was setup IIS Express properly.
I right clicked on my project Properties => Web (tab) and on Servers:
Project URL was already pre-populated and I clicked the button "Create Virtual Directory".
I had just reinstalled (refreshed) windows and the IIS was not setup b/c it was new.
I came across the same problem and found that somehow the file 'applicationhost.config' (in ..\Documents\IISExpress\config) had a different localhost port number (in the 'sites' section) to the one specified in project\properties\web. Changed them to the same number and the problem went away
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Hit F5 and IIS Express should load as normal, allowing you to debug.
If this not working, then:
right click your solution and go to properties
Click left menu Web tag
Click checkbox "Override application root Url"
and run again your project.
For me this was the solution,
Close all running Visual studio instances
Open the solution folder and remove the .vs folder (hidden folder)
Open Run Command
Type iisreset and press Ok, and you may see a command prompt and
wait for it to complete and it will close automatically
Now Open visual studio and run your project, it should run.
So, nothing worked for me and this happened to happen to me when I got a new machine. Apparently it didn't have the older versions of .Net on it. Went into VS Installer and checked the box for .Net 5 Runtime (VS 2022). Working fine now on all .Net 5 Projects.
TL;DR: if you do have the right .NET Core (or .NET I guess) runtime installed, install any patch updates or reinstall the latest version if there aren't any.
Detail:
Similar to a couple of other answers where they just didn't have the right .NET core installed. I was trying to run a .NET Core 3.1 web app which had worked fine previously for months, and this suddenly started happening.
I did have 3.1 (runtimes 3.1.21 and 3.1.22) installed. However a new one (3.1.23) had been released 12 days earlier, and installing that fixed the problem.
I have no idea if this was because it's aware that there's a new patch and I didn't have it so it wouldn't run, or if there was just something wrong with my 3.1.22 installation. Worth trying installing latest patch, or reinstalling existing installations.
I encountered this while trying to run a project I'd run many times on a machine I'd used for the project many times. Cleaning up my IIS Express directory and my .vs directory didn't work, nor did setting environment variables. I even tried re-cloning my repository to a different folder, but no success.
By trying to run via command line, I found a more useful message:
dotnet run --project [startup project path]
I saw that the project was trying to run using .NET 6.0.5, but I only had .NET 6.0.4 installed. Installing the latest .NET 6.0.5 from the Microsoft website worked.
I also had the same problem, doing the above didn't work for me. What my error turned out to be was twofold.
I had Opera as my default browser and it couldn't attach to that.
I had multiple startup projects so it wouldn't let me switch to IE until I change the default startup project back to just the MVC shell.
I set that project specifically as the startup, then I switched it back to launching IE and it started debugging again.
What I did to make this go away:
Open C:\Users\gr_mext1\Documents\IISExpress\config\applicationhost.config and remove all <site> entries in <sites> do not remove <siteDefaults>!
In your project, go to Properties, Web and click "Create Virtual Directory".
Close and re-open visual studio, load your project and run
Fixed!
None of the listed solutions worked for me. Problem was some sort of conflicting state in local applicationhost.config file. Fix is easy, just delete one in your solution. For VS2015 it should be located in <path_to_your_solution>\Solution\.vs\config\. When you launch Debug, VS will recreate that file based on settings in your project file.
Deleting the hidden .vs folder didn't work for me since the port specified in my app was being used by another app. Doing the following worked for me:
Went to properties and then click the web tab.
Changed the port number in the Start Url and the Project URL.
Clicked Create Virtual Directory.
Save and Press F5.
cmd - regedit-HKEY_LOCAL_MACHINE-SYSTEM-CurrentControlSet-Services-HTTP-START=3
Computer restarted.
worked for me!
Tried most of the things here to no avail, but finally found a fix for my machine, so thought I'd share it:
Following previous advice in another question, I had used netsh to add :: to iplisten. It turns out undoing that was my solution, by simply replacing add in their advice:
netsh http delete iplisten ipaddress=::
You can also do this manually by deleting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList from the registry and restarting the service/your PC.
I update my Visual Studio to 2019 version and has this problem, I tried all solution from this question but it doesn't help to start my ASP.NET MVC 5 project with IIS Express. After I remove IIS Express (using Control Panel), download last version from www.microsoft.com and install it. After this everything works fine.
After some weeks i got update for Visual Studio and I got this problem again. I remove IIS Express and reinstall and it works fine now.
p.s. repair didn't help me, only uninstall and install.

"Bogus" Web project requires missing web component message for razor

Using Visual Studio 2010, MVC 3 (release version) I'm getting this error when opening a specific project which was a traditional web forms project to which I've added MVC:
"The Web project '' requires missing web components to run with Visual Studio. Would you like to download and install the using the Web Platform Installer now?
ASP.NET Web pages with Razor syntax."
I have MVC installed and fully running. Other pure MVC and another mixed Web Forms/MVC project open without any issue.
Clicking "Yes" appears to go through downloading and installing, but the error remains.
Clicking "No" opens the project, where I have intellisense and syntax highlighting for Razor, all my MVC context items (Add View, Add Controller, etc.). In short, everything appears to be working just fine except for what appears to be a bogus error message.
I've done a file compare of the sln, csproj and web.config files and added everything that appears relevant. Prior to doing that I was missing some entries in ProjectTypeGuids the addition of which got the MVC context menus and Razor intellisense working. I tried resetting the ProjectGuid but I still get the error.
I have also previously gone through uninstalling MVC3, MVC2, ASP.NET Web Pages, repairing Visual Studio, installing MVC 3 from the stand-alone installer, and probably a couple more things. I have not yet tried a full system reinstall. I am working from a relatively clean Windows 7 installation. It was a fresh setup about 2 weeks ago and only VS 2010 has been installed (no older versions or betas).
I'm out of ideas at this point. Anyone got any suggestions? I'm a bit confused since this is project-specific, yet the error message indicates that the problem is with Visual Studio.
Update: it gets a little more interesting. Another developer was able to open the same project on his machine without any errors or warnings. So it's something specific to this project on my workstation. At this point I'm willing to write it off as some obscure edge-case bug.
Update 2: And now after rebooting for a system update it's working on my workstation. Definitely some sort of edge-case, and definitely not something I can reproduce.
You can see from the updates, that the problem has gone away after a system-update prompted reboot. So if anyone else has ended up here with a similar problem and you've gone through all the other possibilities, try rebooting.

Automatically attaching to support behavior not completely successful

I have a Visual Studio 2010 solution containing several C# projects, with Resharper 5.1 installed and enabled. All these projects target the .NET Framework 4.
This solution has been working fine for months, but this morning I got the following message when the solution was loaded:
I've looked around for an explanation on the meaning of this message, but with little luck.
Additionally, I haven't been able to repro this error, and it doesn't seem to have broken anything on my project.
Still, I don't like these kind of unexplained errors, so I was wondering if anyone reading this knows the root cause?
Hmm, that's special. It must be a debugger notification, the part of VS that 'attaches' and makes "Managed" a category. The other category is "Unmanaged", a different kind of debugger interface. It clearly lost its marbles there.
Counter-measures, in order, are:
Restart VS.
Reboot
Install Service Pack 1, it has many debugger fixes.
Consider moving 3 up the list if you haven't installed it yet, there are a ton of bug fixes and tweaks and works well.
In Visual Studio 2012 and Windows 8.1, I had this problem,I changed X86 from Solution Properties/Build/Platform target then my problem resolved.
This has been nagging me for a while. Finally I found a solution.
When I press the help button they suggest I sort out the attached debug option. Without any result I finally managed to check the Enable SQL Server Debugging option under Project Properties - Debug.
I have the exact same setting as you: VS2010 with several C# projects pointing to Net 4 and Resharper 5.1. I'm on Windows XP SP3
I was getting the exact same error, along with an empty VS icon in the taskbar.
The empty icon got away when I shifted VS to my main monitor (I have 2) and restarted. It seems that VS doesn't like to be in the second monitor.
As for your error, I cleaned up the Resharper cache (I'm storing it in the TEMP folder, not the solution folder) restarted, and didn't get the error again
In Debug Menu - GoTo Solution Properties and select debug tab and tick the ENABLE SQL SERVER DEBUGGING checkbox

Resources