我有一个ASP。NET MVC 4解决方案。当我尝试使用Visual Studio 2012打开它时,我得到以下错误:

Microsoft Visual Studio 为ASP配置Web https://localhost:。NET 4.5失败。你必须 手动配置此站点的ASP。NET 4.5才能使站点 正确地运行。无法在https://localhost:44300/上找到服务器 本地机器。确保已配置本地IIS服务器 支持安全通信。

尽管解打开了。此外,当我试图从调试菜单运行它时,我得到以下错误:

无法启动IIS Express Web服务器。 指定的起始URL无效。https://localhost:44300/

我无法调试代码。如何摆脱这些错误和调试/运行网站从VS 2012?


当前回答

我将提出一个解决这个问题的方法:

1.使用以下控制台命令删除\Documents\IISExpress文件夹:rmdir /s /q "%userprofile%\Documents\IISExpress"

Delete the applicationhost.config file which is placed within the .vs\Config\ folder in your Visual Studio project root folder. Change the project’s website random URL: within Visual Studio, right-click to the project node in Solution Explorer, then select Properties; navigate through the Web panel, then change the number in the Project Url textbox value. Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1 as shown in the following screenshot (thanks to Juan M. Elosegui for reporting this on this SO thread and for the image):

好运!

其他回答

我在VS2012中运行我的解决方案时遇到了类似的问题:

无法启动IIS Express Web服务器。 指定的起始URL无效。https://localhost:44301/

我将不正确的项目选择为启动项目。我使云项目启动(右键单击项目->设置为启动项目),一切开始工作正常。

我的问题需要三方面的解决方案:

删除Documents文件夹中的IISExpress文件夹。 通过右键单击并选择“设置为启动项目”,或者通过解决方案属性将web项目设置为启动项目。 设置启动URL,或设置为“当前页面”或“特定页面”。我的设置是“不要打开任何一页”。等待来自外部应用程序的请求”,我不得不将其更改为“特定页面”,我将其留空,这样它就会进入我的应用程序的主页,然后才能正常工作。

我也有同样的问题,感谢@Jacob提供的信息。

原因是-在配置文件applicationhost中错误的项目条目

C:\Users\(yourusername)\Documents\IISExpress\config 

关闭所有Visual Studio解决方案。 重命名IISExpress文件夹为一些IISExpress- copy(而不是删除你可以有一个副本) 现在再次打开VS并构建/调试项目,现在你会看到IISExpress文件夹再次为你创建了正确的配置。

在我的情况下,我的applicationhost。配置文件以某种方式缺少以下两行代码

<add name="rules-64-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
<add name="xoml-64-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

我也有同样的问题。我已经删除了C:/users/ path下的很多文件夹,以释放机器上的一些空间。在那之后,我开始得到这个错误。

我只是重新启动了我的机器,一切都很好。