我有一个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?


当前回答

同样的问题,但是需要在管理模式下启动VS2013。

其他回答

我也有同样的问题。 原因是IIS配置文件不好。

尝试删除自动创建的IISExpress文件夹,该文件夹通常位于%userprofile%/Documents,例如C:\Users\[you]\Documents\IISExpress。

别担心,一旦你再次运行你的解决方案,VS应该再次创建它——这次是正确的。


EDIT:删除文件夹的命令行:

rmdir /s /q "%userprofile%\Documents\IISExpress"

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

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

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

在我的情况下,我允许外部请求到我的IIS Express网站,并配置windows防火墙允许iisexpress.exe,我不能从Visual Studio 2013中启动它。我仍然可以用命令行启动它,它可以很好地服务本地和外部请求。

C:\Program Files (x86)\IIS Express>iisexpress /site:MyWebSiteName

我试着创建一个防火墙规则来允许我的端口,在VS工作之后。

@roblll说对了。但对于那些不想挖掘答案的人来说,这就是:

Close Visual Studio (might not be necessary, but it won't hurt). Navigate to your Documents folder. This is where my IISExpress configuration directory was. In the config folder, there is a file called the application host. Open that. Search for the name of your project. It should have been added in there by Visual Studio when it bombed in your previous attempts. Note that there's a binding for HTTP with the port you intend to use for https. //Change this: <binding protocol="http" bindingInformation="*:44300:localhost" /> //to this: <binding protocol="https" bindingInformation="*:44300:localhost" />

请记住,Visual Studio可能提供了与您期望的不同的端口。只需确保绑定中的端口对应于项目属性的Web选项卡中的端口。

http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

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

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

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

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