当遇到“无法启动 IIS Express Web 服务器。”时的解决方案

来自:https://stackoverflow.com/questions/23502327/unable-to-launch-the-iis-express-web-server-failed-to-register-url-access-is-d/28650554#28650554

---------------------------

Microsoft Visual Studio

---------------------------

无法启动 IIS Express Web 服务器。

来自 IIS Express 的输出:

Failed to register URL "http://localhost:24924/" for site "XWG.WEB" application "/". Error description: 另一个程序正在使用此文件,进程无法访问。 (0x80070020)

---------------------------

确定

---------------------------

当遇到以上错误时,在链接地址的回答中给出了很多方案,其中对我有效的一个方案是:

使用文本编辑器编辑项目的 csproj 文件,找到:

<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:24924/</IISUrl>

删除这三行,重新加载项目运行即可。