首页 > 解决方案 > 使用 ASP.NET Core 应用程序 (VS2017) 从命令行运行 IIS Express 时出错

问题描述

我正在尝试手动运行 IISExpress,以便稍后添加 OpenCover 覆盖范围。这是一个 .NET Core 2.2 应用程序。我能够从 Visual Studio 中启动该应用程序,并且一切运行良好。现在我想在命令行上手动启动它。我使用VS生成的applicationhost.config。

我按照OpenCover for ASP.Net Core application running on IIS Express的回答中所说的话,即适应了我的环境:

我是从 C:\Program Files\IIS Express> 中的(非管理员)命令提示符执行此操作的

set LAUNCHER_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe
set LAUNCHER_ARGS=-p "C:\Program Files\dotnet\dotnet.exe" -a "exec ""C:\Workspace\wk1\nSKEP\Dev\WebAccess\Dscp.Api\bin\Debug\netcoreapp2.2\Dscp.Api.dll"""
iisexpress.exe /config:"C:\Workspace\wk1\nSKEP\Dev\WebAccess\.vs\config\applicationhost.config" /site:Dscp.Api

IISExpress 启动并运行。但是当我尝试连接到我的网站时,我得到以下响应:

HTTP Error 500.0 - ANCM In-Process Handler Load Failure
Common causes of this issue:
* The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
* The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application.
* ANCM could not find dotnet.
Troubleshooting steps: Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect

For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526

我访问了链接的网站并用谷歌搜索,但没有找到任何帮助。

在 Win10 系统事件查看器中,我收到“IIS Express AspNetCore Module V2”的以下错误:

Application 'C:\Workspace\wk1\nSKEP\Dev\WebAccess\Dscp.Api\' wasn't able to start. Application .dll was not found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.dll

显然很有趣的是,当我在路径中指定了 VSIISExeLauncher.exe 时,它​​谈到了 VSIISExeLauncher.dll。

怎么了?

标签: asp.net-corevisual-studio-2017iis-express

解决方案


推荐阅读