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


当前回答

在我的情况下,IIS Express应用程序主机。配置文件中几个元素的managedRuntimeVersion属性有一个拼写错误。这是发生在Visual Studio 2012和Visual Studio 2013。我只收到了邮件的第一部分,内容是:

无法启动IIS Express Web服务器。

它在事件日志中记录了一个错误,消息如下:

工作进程未能预加载. net Runtime版本v4.030319。

正确的运行时版本是v4.0.30319(注意第二个周期)。

我采取的纠正措施:

导航到C:\Users\ Documents\IISExpress\config 编辑applicationhost.config 查找配置部分 将任何引用“v4.030319”的内容更正为“v4.0.30319”

在我下次调试web应用程序时,Visual Studio成功启动了IIS Express。

其他回答

当我查看IIS Express注册表项时,我的问题最终解决了:

HKEY_CURRENT_USER\Software\Microsoft\IISExpress

我有一个CustomUserHome的入口指向我的网站,这是造成严重破坏。

我也有这个问题,在关闭防火墙后,在以管理员身份打开,在再次检查所有设置是否正确后。

我的问题是独特的,我想在本地测试SSL,但也有通过局域网可用的服务。所以我改变了应用程序的URL使用本地IP aka。我的情况是192.168.1.10。

切换回本地主机可以解决这个问题,关闭SSL也一样,所以我发现本地SSL证书只适用于本地主机。

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

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):

好运!

确保以管理员身份运行VS !这将解决一切问题。比我晚。

分享给未来的读者。手动创建一个虚拟目录对我来说很有用。

在解决方案资源管理器中选择项目 按Alt + Enter 转到网页部分 单击“创建虚拟目录”