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

其他回答

首先删除目录中存在的文件IISEXPRESS,然后开始调试。

如果这不能解决问题,转到您的项目(Ctrl+Alt+L)。右键单击->属性->调试和检查“启用Windows身份验证”。

在安装Visual Studio 2013 Update 3后,我也遇到了同样的问题。 vs2013无法加载Microsoft.VisualStudio.TraceLogPackage.dll 无法启动IIS Express Web服务器 我的问题是通过以下步骤解决的: 1. 修复Visual Studio 2013更新 2. 以管理员身份启动开发人员命令提示符。 3.输入devenv.exe /setup,然后按enter

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

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

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

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

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

Before you try anything else, make sure you 1. restart visual studio (mostly for refreshing memory resident options from files) and 2. restart your system (mostly for invalid file locking). If your problem is such temporary or self-fixed those will do without changing anything. It worked for me with PC restart. Also if you work on a multi-user project make sure you have the latest workable version - someone else may had check in something invalid by mistake at e.g. the project file and you mess with your system for no reason. If those won't work, then you probably need to alter some setting(s) that are stuck, missing or need modification - there are plenty propositions on other answers.