Debugging the “Unable to launch the IIS Express Web server.” error from Visual Studio 2012.
Hello,
I’ve recently solved this issue on my machine and thought I would share this with everyone.
Visual Studio 2012 is configured to use IIS Express by default and on my laptop I noticed that I started to see this error.
So I looked at how best to resolve this issue.
Sites from Web Matrix worked fine in IIS Express and IIS Express would launch from the command line.
I started by using Process Monitor to troubleshoot this issue.
I started Process Monitor and set up a filter like this.
I started by looking at the Process Start event.
I looked at the Properties of this event and noted that the Process was starting like this.
"C:\Program Files (x86)\IIS Express\iisexpress.exe" /config:"C:\Users\MyUserName\Documents\WebMatrix\config\config\applicationhost.config" /site:"WebApplication2(1)" /apppool:"Clr4IntegratedAppPool"
Then I tried running this from a command prompt and see this underlying error.
”The following site was not found in the configuration file: 'WebApplication2(1)'”
So now I know that
a) My IIS Express install is using the Web Matrix Config file.
b) It can’t find the site from my Visual Studio 2012 solution.
Issue Cause.
When Visual Studio 2012 is creating the site in IIS Express it is updating the config file at C:\Users\MyUsername\Documents\IISExpress\config\ and not the Web Matrix one.
I then remembered than when I installed Web Matrix it told me it could not access the IIS Express config file and if I would like to create a new config file.
It turns out that this adds a new REG_SZ value called CustomUserHome at HKEY_CURRENT_USER\Software\Microsoft\IISExpress.
This points to the Web Matrix Config file and not the IIS Express one.
I edited this registry key to point to C:\Users\MyUsername\Documents\IISExpress and now it all works.
I hope this helps.
Comments
Anonymous
January 31, 2013
Unable to lounch iis web server in vs 2012 ultimateAnonymous
June 06, 2013
I could not find the IISExpress registry entry in Windows 7.Anonymous
June 06, 2013
Hi Sonny, I don't have a Windows 7 image at the moment to test against. I'll see if I can get one up and running and check if the registry key is there. Thanks, FinbarAnonymous
July 02, 2013
ON THE MONEY!!!! I jus t went from a demo using Web matrix to a demo using VS 2012 and Bingo! same problem. This fixed It THANK YOUAnonymous
July 19, 2013
Should have updated on, project >> Properties >> Web (tab). On Web tab you will see the choices from IIS Express 7/8 (if installed) and in Server Section Use Visual Studio Development Server. HTH Aamir QureshiAnonymous
September 17, 2013
super aamirAnonymous
October 18, 2013
Aamir's technique worked perfectly and easily!Anonymous
October 19, 2013
Hi, thanks for all of your comments on this post. I agree that switching to the Asp.Net Development Server may be an acceptable workaround for some people. The reason that we have IIS Express is an option is that it's the same engine as the full IIS Server and so offer's better fidelity when debugging Asp.Net issues. ScottGu talks more about this at weblogs.asp.net/.../introducing-iis-express.aspx Thanks, FinbarAnonymous
October 13, 2015
so where are the steps to resolve the issue