这个问题在这里已经有了答案:
Launch IIS Express to run ASP.NET Core Apps
(3 个回答)
去年关闭。
我有一个依赖于许多其他服务的服务,在开发期间,我只是启动所有其他服务(手动使用 VS 2017)。为了避免该步骤,我尝试使用以下命令创建一个批处理文件,以使用 IISExpress 托管我的 ASP.NET Core Web API。
dotnet build
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe" -p "C:\Program Files\dotnet\dotnet.exe" -a "exec \".\Service\bin\Debug\netcoreapp2.0\MyService.dll\"" -pidFile [System.IO.Path]::GetTempFileName() -wd ".\"
从 PS 命令提示符(管理员)调用批处理文件时,出现以下错误
Failed to launch processs: C:\Program Files\dotnet\dotnet.exe
Last error = 267
上面的命令有什么问题吗?
最佳答案
您还必须设置环境变量,我在以下博客文章中清楚地记录了这一点,
https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3
关于asp.net-core - 使用命令行调用 IISExpress 来托管 ASP.NET Core 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47122376/