29

UPDATE

I'm certain this is a Visual Studio bug with no obvious solution. I've encountered a number of people who have the same exact issue. I have submitted a bug ticket with Microsoft here:

http://connect.microsoft.com/VisualStudio/feedback/details/778864/vs2012-is-spawning-two-iisexpress-processes-when-attempting-to-debug

If you are having the same issue as described below, please go vote up the bug ticket so that it gets more attention.


Whenever I attempt to debug an MVC3 (or MVC4) application in Visual Studio 2012 configured to run on IIS express (version 8), I get the following error:

enter image description here

Here's the kicker: IIS Express is starting, even though Visual Studio doesn't think so and the debugger fails to attach. The IIS Express tray opens and I can clearly see all configured websites are started:

enter image description here

Oddly enough, the IIS Express System Tray reports that there were some errors when running IIS Express. Here's what it says:

enter image description here

This is a serious WTF. It's reporting that 8080 is being used by an IIS Express Process - the one that was just started by Visual Studio. So, Visual Studio is attempting to launch IIS twice, and when it predictably fails the second time, the debugger bails. I should note that before launching the debug configuration in Visual Studio, I made absolutely sure no IIS Express processes were already running. I used Process Monitor to verify that Visual Studio is in fact attempting to launch IIS Express twice:

enter image description here

Notice in the screen shot above you can clearly see websites running on IIS Express PID 4732. PID 4924 is the second failed attempt at launching IIS Express.

This issue was initially occurring on a Windows 7 installation. I reformatted completely, installed a fresh copy of VS2012, and got the same issue. I went a step further and reformatted, installed Windows 8 and a fresh copy of VS2012, and the issue persists.

I have created brand new blank MVC3 and MVC4 projects. Nothing fixes it.

I'm tearing out my hair here. Any help would be greatly appreciated.

w.brian
  • 16,296
  • 14
  • 69
  • 118
  • Have you installed any extensions? – Erik Funkenbusch Feb 07 '13 at 22:58
  • @w.brian, what happens if you switch back to cassini? – Dave Alperovich Feb 07 '13 at 22:59
  • None. I have installed Visual Studio 2012 Update 1. Otherwise it is a completely vanilla installation. – w.brian Feb 07 '13 at 23:00
  • @DaveA Cassini works fine, but I require IIS Express. – w.brian Feb 07 '13 at 23:00
  • Understood. I prefer IIS Exp too. Looking for info to triangulate. Have you played with switching between dedicated and dynamic port? Have you recently upgraded VS (2012?) – Dave Alperovich Feb 07 '13 at 23:02
  • Per my post, this issue is specific to visual 2012, and I have reformatted my computer twice, once with Windows 7, and now with Windows 8 in an attempt to resolve this issue. These are very clean, vanilla installations. – w.brian Feb 07 '13 at 23:06
  • Have you tried running IIS Express manually from the command-line? – Chris Moschini Feb 09 '13 at 20:51
  • Yes. Running from the command line works just fine, as long as there isn't already an IIS Express process running. – w.brian Feb 09 '13 at 21:51
  • What version of Visual Studio do you use? Have you tried uninstalling IIS Express and then install it again? I'd really try another distribution of Visual Studio. Either a trial or an Express version just to rule a lemon compilation of Visual Studio out. – OakNinja Feb 15 '13 at 22:45
  • Visual Studio 2012 as specified in both the title and the body of the question... – w.brian Feb 15 '13 at 22:47
  • There is several versions of Visual Studio 2012. See my updated comment above. – OakNinja Feb 15 '13 at 22:48
  • I have tried uninstalling and reinstalling IIS Express. I have tried uninstalling Visual Studio 2012 and running before installing Update 1, and after installing Update 1. Nothing works. – w.brian Feb 15 '13 at 22:54
  • What media did you use to install Visual Studio 2012 then? – OakNinja Feb 15 '13 at 23:32
  • Over a file share with an enterprise license. – w.brian Feb 16 '13 at 18:28
  • And have you tried uninstalling and using a different media, like a trial version? – OakNinja Feb 16 '13 at 19:27
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/24639/discussion-between-oakninja-and-w-brian) – OakNinja Feb 16 '13 at 19:36
  • Late to the party here but have you verified that nothing else is accessing the port you're trying to use? `netstat -aon | find ":8080"` - you don't use Raven by any chance do you? Port 8080 is the standard port for RavenDB – levelnis Feb 18 '13 at 22:05
  • Nothing is using the configured ports. As I had mentioned, IIS Express starts successfully. The issue is that Visual Studio attempts to launch it twice, and the debugger fails to connect when it fails the second time around. Essentially, IIS express starts, VS fails to attach and debug. – w.brian Feb 18 '13 at 22:25
  • Are you running VS 2012 with administrator privileges – Anand Feb 19 '13 at 01:16
  • I've tried that. Doesn't work. – w.brian Feb 19 '13 at 03:22
  • Did you try a different media source, trial version etc? A clean version of Windows with a clean updated version of Visual Studio should really behave like everyone elses set up. Otherwise everyone would have this issue. Set up a Win8 VM and try a VS2012 trial there to avoid messing around. – OakNinja Feb 19 '13 at 07:36
  • Do you have anything special in the project properties page? Right-click the project > Web (tab) > Servers section or in the Build Events (tab) > pre-post-build event? Can you include the steps on how you configured the project to run on IIS Express? – Andy Refuerzo Feb 20 '13 at 18:44
  • The issue occurs with completely new, untouched MVC3 and MVC4 projects. There are no pre or post build events. When creating a MVC project in Visual Studio 2012, it is set by default to launch using IIS Express. – w.brian Feb 20 '13 at 18:47
  • If IIS express is getting started for the first time, and you are able to browse the application, then why don't you attach to that process manually from VS debug option. That will help you to debug. – dicemaster Feb 22 '13 at 16:40
  • Because debug symbols do not get loaded when manually attaching to the IIS Express process. – w.brian Feb 22 '13 at 17:50
  • @w.brian, The problem cannot be in IIS Express since you have re-formatted and re-installed. It must be in your Project or Solution. Do you have multiple projects in your solution? – Dave Alperovich Feb 25 '13 at 23:51
  • @w.brian, also are you using virtual directories? – Dave Alperovich Feb 26 '13 at 00:00
  • I have the exact same behavior on a fresh install of VS2012. Curiously, VS2010 also displays the same behavior on the same machine. – ardila May 29 '13 at 13:34

11 Answers11

8

w.Brian, I have followed this post since it's start and have had the exact same problem for quite a while now and I have just discovered what is causing the issue for me. I have been able to reproduce and fix the error for myself with this:

The reason VS2012 is starting iis express twice is related to being attached to a domain and being logged into a domain account. Once I logged into a completely local admin account I was able to launch and debug an MVC4 application without any issues. This is using Windows 8 Pro, VS2012 Update 1, attached to my domain, and no other software/extensions/configuration. Completely clean installation.

Ben Guenter
  • 208
  • 3
  • 10
  • Dude, yes. I am definitely having this issue on a domain but never considered that. I will be able to verify this tomorrow. I'll mark as answer if this is the problem and let Microsoft know on the bug ticket I opened. – w.brian Mar 21 '13 at 00:13
  • You rock Epithanatios. You were absolutely correct. I will let Microsoft know. – w.brian Mar 21 '13 at 15:58
  • Hi w.brian, would you be able to try a different domain account on your test machine? I have tried successfully to launch visual studio with my test machine with any other domain account except for mine. I'm almost at the point where I am going to ask to have my account wiped and a new one created. It seems to be related to how my account was setup but we are not sure what is different between mine and anyone elses. – Ben Guenter Mar 27 '13 at 14:49
  • Thanks @w.brain for doing this research. I too had this problem across installs and figured IISExpress was being launched twice. However, I don't want to have to run it with another domain account. Here's hoping that MSFT fixes the problem. – BrandonG Feb 13 '14 at 21:34
  • I'm experiencing this problem now. I've logged onto other DEV machines (where the devs do not have the problem) and seen the same error. They've come to my machine and successfully debugged the app. My I.T. is doing a deep dive into my domain user attributes, but we'll probably end up creating a new user. :( – Griffin Oct 14 '14 at 15:53
  • Also interesting to note that the error happens regardless of whether or not IIS Express is already running. Sometimes the alert includes the complaint that the port is already in use. Most times it doesn't. – Griffin Oct 14 '14 at 15:56
5

Hi maybe this solutions could help you.

  • Manage RuntimeVersion=”4.0″ to “4.0.30319″

Example:

<applicationPools>
<add name=”Clr4IntegratedAppPool” managedRuntimeVersion=”v4.0.30319″ managedPipelineMode=”Integrated”     CLRConfigFile=”%IIS_USER_HOME%\config\aspnet.config” autoStart=”true” /><br/><br/>

reference:Issue: Visual Studio 2012 > “Unable to launch the IIS Express Web Server”

Under the / element, comment out the line

<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />

Under the // element, comment out the line

<add name="HttpLoggingModule" lockItem="true" /> 

After saving your changes try restarting iis express.



reference: from stackoverflow forum: Unable to launch the IIS Express Web server

Community
  • 1
  • 1
bot
  • 4,841
  • 3
  • 42
  • 67
  • 2
    It worked for me. Simply switching to Visual Studio Build in Dev Web server and then running the app. Restarting then switching back to Local IIS Express. – Patrik Lindström Mar 10 '13 at 15:09
  • 1
    Thanks for compiling these answers, as I've seen them scattered through various SO and Technet questions. None of them have worked for me either. Upvoted the bug at Connect. – ardila May 29 '13 at 13:36
4

Right click you MVC project /*all of them one by one*/
go to properties
go to web tab
you must be having having checked "Use local IIS webserver" radio box
in the textbox below it make sure no to projects have the same port which in your case is 8080

Parv Sharma
  • 12,581
  • 4
  • 48
  • 80
3

Have a look at the answer here:

http://forums.asp.net/t/1953087.aspx?VS+2013+Unable+to+launch+the+IIS+Express+Web+Server

It was strange behavior on a Windows 8 machine when 'bg' was part of the username

tony
  • 2,178
  • 2
  • 23
  • 40
  • This worked for me as well. I also had to delete my existing iis express directory in order to get it to work. – BrandonG May 29 '14 at 17:48
  • Also look at this bug tickets: https://connect.microsoft.com/VisualStudio/feedback/details/848945/visual-studio-2012-iis-express-fails-to-start-if-application-name-contains-bg https://connect.microsoft.com/VisualStudio/feedback/details/865116/process-with-an-id-of-id-is-not-running – David Jun 10 '14 at 20:27
2

I might be a little late to the party - here's my two pennies:

a) http://saintgimp.org/2012/05/03/fixing-the-error-unable-to-launch-the-iis-express-web-server-failed-to-register-url-access-is-denied/

b) http://abhijitjana.net/2010/07/20/unable-to-start-web-site-on-iis-process-can-not-access-the-file-because-its-being-used-by-another-process-how-to-resolve/

Synopsis: There is a URL reservation for the current port (usually Skype)

Barrie Reader
  • 10,647
  • 11
  • 71
  • 139
  • 1
    I feel like people are neglecting to read the original question. This is *not* an issue with IIS Express not starting. IIS Express *is* starting, but for some reason Visual Studio is attempting to start it *twice* and the debugger fails to connect. – w.brian Feb 20 '13 at 15:58
  • @w.brian - Exactly what I get, no progress? Once I've closed the error dialog, I'm able to run the site from the IISExpress toolbar utility. But it's a pretty poor experience – philiphobgen Feb 20 '13 at 18:06
  • @stupid-phil No progress. I'm certain at this point it is a bug. I have created a bug ticket with Microsoft here: http://connect.microsoft.com/VisualStudio/feedback/details/778864/vs2012-is-spawning-two-iisexpress-processes-when-attempting-to-debug I think the best bet to get this resolved is to vote up the ticket so that it gets some attention. – w.brian Feb 20 '13 at 18:14
  • I have asked a question several times: Have you tried a different Visual Studio 2012 source, like the official trial version? @stupid-phil, what is your set-up? – OakNinja Feb 20 '13 at 23:30
  • I have an MSDN download of VS2012 Ultimate. Running on Win8 Pro – philiphobgen Feb 21 '13 at 12:09
  • Just to rule some scenarios out: What version on IIS Express is installed? Have you tried reinstalling IIS Express by uninstalling in from add/remove programs and then reinstall using web platform installer? Have you reset your Visual Studio settings(http://msdn.microsoft.com/en-us/library/ms247075.aspx)? Have you tried creating a new Windows user with admin rights and tried debugging with that user just to rule out user setting errors? If this fails - try a Visual Studio Trial to rule out errors specific to your msdn source. – OakNinja Feb 21 '13 at 12:35
2

Just in case, do you have 127.0.0.1 localhost defined in folder/system32/drivers/stc/hosts ? Otherwize, you can check here, this might just be the key.

Cheers

g00dy
  • 6,752
  • 2
  • 30
  • 43
1

I had the same issue on Windows 8 and Windows 8.1 using my domain account. In my case changing the Documents folder path (Right click on the Documents folder -> Properties -> Location) from C:\Users\username\Documents to D:\Documents helped

bgw
  • 11
  • 1
1

This week, I experienced this identical issue: IIS Express starts, but VS complains it couldn't start IIS Express and debugging fails.

I finally resolved the issue by applying the June 2014 hot-fix to IIS Express:

We (my IT support and I) found this hotfix after stumbling over and following a very unlikely problem. Apparently, MS verified a bug in IISExpress 8.0 which results in it misbehaving if any part of the application name contains the letter combination "bg" (my username begins with bg):

Note: VS 2013 Update 4 already contains this fix, which may be why some people had success simply by updating to VS 2013.

Some other links we found concerning the issue (you may have to skim a bit to find the topic):

Griffin
  • 1,586
  • 13
  • 24
1

What worked in my situation was to unload the project, then to edit the csproj file. I removed all sections regarding IIS and IISEXPRESS. Then I reloaded the project and chose USE IIS EXPRESS from the project properties all over again. It then worked.

BornToCode
  • 9,495
  • 9
  • 66
  • 83
0

I ran into an identical issue today (IISExpress trying to start twice and failing when hitting Debug in Visual Studio) while helping another developer with a web forms site. After trying several solutions, we found that we could resolve the problem by:

  • Creating a new, empty Visual Studio solution
  • Adding an "Existing Website" pointing to a new, empty folder
  • Copying the contents of the existing (non-working) website into the new folder we created

Simply removing and re-adding the website to the original solution did not work, nor did creating a new solution and adding back the existing site. I can start IISExpress from the command line just fine.

After doing a before-and-after comparison of the .SLN files I believe that is where the problem lies. Since I had found a workaround I didn't spend a lot of extra time on it. Obviously recreating the entire solution from scratch may not be an option for larger projects (ours was a very small one) but hopefully this at least points in the right direction.

DVK
  • 2,726
  • 1
  • 17
  • 20
0

There are two instances of the site FrontEnd running of course, but notice that one instance is HTTP and the other HTTPS.

It's possible to get two instances when SSL Enabled is set to True in the web site properties but the Project Url on the Web tab is set to an HTTP address.

Make them both HTTP (or HTTPS) and that might fix it.

Stuart Hallows
  • 8,795
  • 5
  • 45
  • 57