Startup Project keeps reverting to IIS Express for debugging

Viewed 876

In my solution I basically have two projects, the one I'm coding on, and the startup project, Startup.csproj. I have Startup.csproj configured to use Local IIS for debugging, and I normally just attach to the worker process to debug.

However, at random intervals, the Startup.csproj defaults back to IIS Express for debugging. It does not show as a change in the Startup.csproj project file, and sometimes even still shows Local IIS but fails with a "Cannot list contents of directory" error.

I'm running VS 2017 v15.9.15. What could be causing this annoying little phenomenon?

3 Answers

I thought I am going crazy. I found the settings driving that behavior in the project file. I set the UseIISExpress to 'false' and the other one all the way at the end of the file project UseIIS to 'true' and when reloading still set to use IISExpress.

Turns out there's a <ProjectFile>.csproj.user that will overwrite default settings. Search for the UseIISExpress in this file and set it to false and Voila! problem solved.

Restart your IIS and try as above and go to the root directory and delete .vs directory if exists. or In the Processes window (Debug -> Windows -> Processes), right-click on the name of the process you want to detach, and on the shortcut menu, click Detach Process.:

Another scenario may be that the port that IIS is using for your application is already being used by another running application. Try changing the port and see if it works for you.

Related