This morning, while trying to debug our big ol’ web project in Visual Studio 2015 I encountered a problem – it held me up for a while so I wanted to quickly blog about the solution in case it hits you too. When hitting F5 to start debugging, Chrome launched but then immediately Visual Studio detached from IIS Express and showed the following error:

A process with the ID of <id> is not running

True enough, IIS Express wasn’t running…

Open Wide and Say ‘Ahh!’, Mr Windows

I ran a Repair on IIS Express 10.0 in case it was an issue with that, or the self-signed SSL certificate it uses to host web projects over a secure connection…. but still had the same problem.

I then created a brand new ASP.NET MVC 5 project and hit F5… but that ran fine. Hmm, curious. That let me know IIS Express was fundamentally OK, and the issue lay with the big ol’ web project.

Microsoft are usually pretty good at logging when things go wrong so I fired up eventvwr, the Windows Event Viewer, and saw the following  error being thrown by IIS Express:

The Module DLL C:\Program Files (x86)\Microsoft Web Tools\AspNetCoreModule\aspnetcore.dll failed to load. The data is the error

Strange… We don’t have any ASP.NET Core projects in that solution so why aspnetcore.dll is being loaded was beyond me. Furthermore, that path didn’t exist on my disk.

Googling with Bing

I searched around the interwebs for some solutions, the closest I came was somebody saying that AspNetCoreModule (aspnetcore.dll) was no longer shipped separately since ASP.NET Core RC2 and is now instead included in the ASP.NET Core Tools (1.0.0 Preview 2).

Sure enough, the only aspnetcore.dll files I could find were in C:\Program Files\IIS Express and C:\Program Files (x86)\IIS Express (for both the x86 and x64 versions of IIS Express), indicating my recent install of the Preview 2 Tools was successful.

So where the hell was that path to the AspNetCoreModule coming from?!

Getting to the Root of the Problem

As it appeared to be solution-specific I ran a search from within Visual Studio 2015 for “aspnetcore” in all of the solution’s root folder, including subfolders. I had a hit!

C:\git\<solution-name>\.vs\config\applicationhost.config

And in that file I found the offending reference!

I removed it, remember, I didn’t have any ASP.NET Core projects in this solution, and IIS Express was happy to run again and allow me to debug.

Phew.

But how did it get there? Ah-ha! Of course, now I remember! I had actually dabbled in ASP.NET Core in this solution before, although that was in a separate git branch… however, that doesn’t track the /.vs folder, by way of .gitignore, so that hadn’t been reverted when I switched branches. That was the unintuitive bit.

Hope this helps some people!