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


当前回答

我有同样的问题,然后我打开任务管理器->进程,然后杀死iisexpress.exe进程。之后,我尝试运行应用程序,并能够成功地运行它

其他回答

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

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

好运!

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

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

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


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

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

如果使用VS2015或以上版本

确保iisexpress进程没有运行。

确保没有其他进程正在使用所需的端口。你可以通过执行来实现

Netstat -a -b

在控制台中(作为管理员,在开始菜单中键入cmd,右键单击并选择“以管理员身份运行”)。如果您看到状态为ESTABLISHED或LISTENING的条目,则意味着有其他进程正在使用该端口。您需要终止该进程或更改端口。

然后删除以下文件

<<path_to_solution_folder>>\.vs\config\applicationhost.config

注意。vs文件夹可能被隐藏

然后找到<<project-name>>.csproj。用户文件,用文本编辑器(记事本)打开 并确保WebProjectProperties下的IISUrl配置为<IISUrl>http://localhost:XXXXX/</IISUrl>,其中XXXXX是您想要的端口。

在这样做并尝试启动应用程序后,你可能会得到

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

然后转到{项目属性}-> Web,按下“创建虚拟目录”按钮

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

在我的情况下,我的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" />