在VS2012中调试MVC应用程序,两次尝试启动IIS Express

时间:2022-10-18 20:53:57

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:

我确信这是一个没有明显解决方案的Visual Studio错误。我遇到过一些人,他们也有同样的问题。我已经在这里向微软提交了错误提示:

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

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:

每当我尝试在Visual Studio 2012中调试一个MVC3(或MVC4)应用程序时,我都会得到以下错误:

在VS2012中调试MVC应用程序,两次尝试启动IIS Express

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:

这里有一个提示:IIS Express正在启动,尽管Visual Studio并不这么认为,调试器也未能加载。打开IIS Express tray,我可以清楚地看到所有已配置的网站都已启动:

在VS2012中调试MVC应用程序,两次尝试启动IIS Express

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

奇怪的是,IIS Express系统托盘报告说在运行IIS Express时出现了一些错误。这就是它说:

在VS2012中调试MVC应用程序,两次尝试启动IIS Express

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:

这是一个严重的问题。它报告说,IIS Express进程正在使用8080,而Visual Studio刚刚启动了这个进程。因此,Visual Studio正在尝试两次启动IIS,当第二次失败时,调试器就会发生故障。我应该注意,在Visual Studio中启动调试配置之前,我绝对确保没有IIS Express进程已经在运行。我使用Process Monitor来验证Visual Studio实际上试图两次启动IIS Express:

在VS2012中调试MVC应用程序,两次尝试启动IIS Express

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.

注意在上面的屏幕截图你可以清楚看到网站运行在IIS Express PID 4732。PID 4924是启动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.

这个问题最初发生在Windows 7的安装上。我完全重新格式化,安装了VS2012的新副本,并得到了相同的问题。我进一步修改了格式,安装了Windows 8和VS2012的新版本,这个问题一直存在。

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

我已经创建了全新的空白MVC3和MVC4项目。没有修复它。

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

我把头发扯下来了。如有任何帮助,我们将不胜感激。

11 个解决方案

#1


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:

w。布莱恩,我从一开始就一直关注这篇文章,现在有一段时间我也遇到了同样的问题,我刚刚发现是什么引起了这个问题。我已经能够用以下方法重现并修正我自己的错误:

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.

VS2012两次启动iis express的原因与附加到域并登录到域帐户有关。一旦我登录到一个完整的本地管理帐户,我就可以启动和调试一个MVC4应用程序,而不会出现任何问题。这是使用Windows 8 Pro, VS2012更新1,附加到我的域,没有其他软件/扩展/配置。完全干净安装。

#2


5  

Hi maybe this solutions could help you.

嗨,也许这个解决方案可以帮助你。

  • Manage RuntimeVersion=”4.0″ to “4.0.30319″

  • “4.0.30319”管理RuntimeVersion = " 4.0 "

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”

参考:问题:Visual Studio 2012 >“无法启动IIS Express Web服务器”

  • Use Process Monitor to solve the issue

    reference: Debugging the “Unable to launch the IIS Express Web server.” error from Visual Studio 2012.

  • 使用过程监视器来解决问题引用:调试“无法启动IIS Express Web服务器”。“来自Visual Studio 2012的错误”。
  • Try switching to the visual studio built in web host and run it. After you run it once you should be able to switch back to iis express

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

  • 尝试切换到web主机中构建的visual studio并运行它。当您运行它之后,您应该能够切换回iis express引用:从论坛无法启动iis express Web服务器。
  • try re-installing Visual Studio 2010 SP1, which contains iis-express.
  • 尝试重新安装Visual Studio 2010 SP1,其中包含iis-express。
  • disable the logging module by modifying the applicationhost.config, which is located in the %userprofile%\documents\IISexpress\config directory. To do so you will need to comment out a couple lines in the file.
  • 通过修改applicationhost禁用日志模块。配置,位于%userprofile%\文档\IISexpress\config目录中。要这样做,您需要在文件中注释几行。

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.

保存更改后,尝试重新启动iis express。



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

引用:来自*论坛:无法启动IIS Express Web服务器

#3


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

右键单击你的MVC项目/*,所有的都一一打开属性到web选项卡你一定在下面的文本框中检查过“使用本地IIS webserver”广播框,确保没有项目具有与8080相同的端口

#4


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

http://forums.asp.net/t/1953087.aspx?VS + 2013 +能力+ + + + IIS +表达+网络+发射服务器

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

当“bg”是用户名的一部分时,Windows 8机器上出现了奇怪的行为。

#5


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/

一)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/

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)

概要:当前端口(通常是Skype)有一个URL保留

#6


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.

您是否有127.0.0.1 localhost在文件夹/system32/driver /stc/hosts中定义?另外,你可以在这里检查,这可能就是关键。

Cheers

干杯

#7


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

我在Windows 8和Windows 8.1上也有同样的问题。在我的例子中改变“文档”文件夹路径(右键单击“文档”文件夹- >属性- >位置)从C:\Users\username\Documents D:\帮助文档

#8


1  

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

这周,我经历了一个相同的问题:IIS Express启动,但是VS抱怨它不能启动IIS Express和调试失败。

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

我最终通过将2014年6月的热修复应用到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):

我们(我的IT支持和我)在经历了一个非常不可能的问题之后,发现了这个解决方案。显然,MS在IISExpress 8.0中验证了一个错误,如果应用程序名称的任何部分包含字母组合“bg”(我的用户名以bg开头),则会导致该错误行为:

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

注意:VS 2013更新4已经包含了这个补丁,这可能就是为什么有些人仅仅通过更新到VS 2013就获得了成功。

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

关于这个问题,我们找到了一些其他的链接(你可能需要略读一下才能找到主题):

#9


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.

我的情况是卸载项目,然后编辑csproj文件。我删除了关于IIS和IISEXPRESS的所有部分。然后我重新加载了这个项目,并再次从项目属性中选择使用IIS EXPRESS。然后工作。

#10


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:

今天我遇到了一个相同的问题(IISExpress尝试启动两次,在Visual Studio中单击Debug时失败),同时帮助另一个开发人员使用web表单站点。在尝试了几种解决方案后,我们发现我们可以通过:

  • Creating a new, empty Visual Studio solution
  • 创建一个新的、空的Visual Studio解决方案
  • 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.

简单地将网站删除并重新添加到原始的解决方案中是无效的,创建新的解决方案并重新添加现有的站点也是无效的。我可以从命令行启动IISExpress。

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.

在对。sln文件进行前后对比之后,我认为这就是问题所在。因为我找到了一个变通的办法,所以我没有在上面花太多的时间。显然,从头重新创建整个解决方案可能不适合大型项目(我们的项目非常小),但希望这至少指向正确的方向。

#11


0  

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

当然,站点前端有两个实例运行,但是注意一个实例是HTTP和其他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.

在web站点属性中将启用SSL设置为True时,可以获得两个实例,但是web选项卡上的项目Url设置为HTTP地址。

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

使它们同时具有HTTP(或HTTPS),这可能会修复它。

#1


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:

w。布莱恩,我从一开始就一直关注这篇文章,现在有一段时间我也遇到了同样的问题,我刚刚发现是什么引起了这个问题。我已经能够用以下方法重现并修正我自己的错误:

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.

VS2012两次启动iis express的原因与附加到域并登录到域帐户有关。一旦我登录到一个完整的本地管理帐户,我就可以启动和调试一个MVC4应用程序,而不会出现任何问题。这是使用Windows 8 Pro, VS2012更新1,附加到我的域,没有其他软件/扩展/配置。完全干净安装。

#2


5  

Hi maybe this solutions could help you.

嗨,也许这个解决方案可以帮助你。

  • Manage RuntimeVersion=”4.0″ to “4.0.30319″

  • “4.0.30319”管理RuntimeVersion = " 4.0 "

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”

参考:问题:Visual Studio 2012 >“无法启动IIS Express Web服务器”

  • Use Process Monitor to solve the issue

    reference: Debugging the “Unable to launch the IIS Express Web server.” error from Visual Studio 2012.

  • 使用过程监视器来解决问题引用:调试“无法启动IIS Express Web服务器”。“来自Visual Studio 2012的错误”。
  • Try switching to the visual studio built in web host and run it. After you run it once you should be able to switch back to iis express

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

  • 尝试切换到web主机中构建的visual studio并运行它。当您运行它之后,您应该能够切换回iis express引用:从论坛无法启动iis express Web服务器。
  • try re-installing Visual Studio 2010 SP1, which contains iis-express.
  • 尝试重新安装Visual Studio 2010 SP1,其中包含iis-express。
  • disable the logging module by modifying the applicationhost.config, which is located in the %userprofile%\documents\IISexpress\config directory. To do so you will need to comment out a couple lines in the file.
  • 通过修改applicationhost禁用日志模块。配置,位于%userprofile%\文档\IISexpress\config目录中。要这样做,您需要在文件中注释几行。

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.

保存更改后,尝试重新启动iis express。



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

引用:来自*论坛:无法启动IIS Express Web服务器

#3


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

右键单击你的MVC项目/*,所有的都一一打开属性到web选项卡你一定在下面的文本框中检查过“使用本地IIS webserver”广播框,确保没有项目具有与8080相同的端口

#4


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

http://forums.asp.net/t/1953087.aspx?VS + 2013 +能力+ + + + IIS +表达+网络+发射服务器

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

当“bg”是用户名的一部分时,Windows 8机器上出现了奇怪的行为。

#5


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/

一)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/

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)

概要:当前端口(通常是Skype)有一个URL保留

#6


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.

您是否有127.0.0.1 localhost在文件夹/system32/driver /stc/hosts中定义?另外,你可以在这里检查,这可能就是关键。

Cheers

干杯

#7


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

我在Windows 8和Windows 8.1上也有同样的问题。在我的例子中改变“文档”文件夹路径(右键单击“文档”文件夹- >属性- >位置)从C:\Users\username\Documents D:\帮助文档

#8


1  

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

这周,我经历了一个相同的问题:IIS Express启动,但是VS抱怨它不能启动IIS Express和调试失败。

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

我最终通过将2014年6月的热修复应用到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):

我们(我的IT支持和我)在经历了一个非常不可能的问题之后,发现了这个解决方案。显然,MS在IISExpress 8.0中验证了一个错误,如果应用程序名称的任何部分包含字母组合“bg”(我的用户名以bg开头),则会导致该错误行为:

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

注意:VS 2013更新4已经包含了这个补丁,这可能就是为什么有些人仅仅通过更新到VS 2013就获得了成功。

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

关于这个问题,我们找到了一些其他的链接(你可能需要略读一下才能找到主题):

#9


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.

我的情况是卸载项目,然后编辑csproj文件。我删除了关于IIS和IISEXPRESS的所有部分。然后我重新加载了这个项目,并再次从项目属性中选择使用IIS EXPRESS。然后工作。

#10


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:

今天我遇到了一个相同的问题(IISExpress尝试启动两次,在Visual Studio中单击Debug时失败),同时帮助另一个开发人员使用web表单站点。在尝试了几种解决方案后,我们发现我们可以通过:

  • Creating a new, empty Visual Studio solution
  • 创建一个新的、空的Visual Studio解决方案
  • 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.

简单地将网站删除并重新添加到原始的解决方案中是无效的,创建新的解决方案并重新添加现有的站点也是无效的。我可以从命令行启动IISExpress。

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.

在对。sln文件进行前后对比之后,我认为这就是问题所在。因为我找到了一个变通的办法,所以我没有在上面花太多的时间。显然,从头重新创建整个解决方案可能不适合大型项目(我们的项目非常小),但希望这至少指向正确的方向。

#11


0  

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

当然,站点前端有两个实例运行,但是注意一个实例是HTTP和其他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.

在web站点属性中将启用SSL设置为True时,可以获得两个实例,但是web选项卡上的项目Url设置为HTTP地址。

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

使它们同时具有HTTP(或HTTPS),这可能会修复它。