使用命令行调用 IISExpress 以托管 ASP.NET Core App

Invoking IISExpress using command line to host ASP.NET Core App

我有一个服务依赖于很多其他服务,在开发期间,我只是启动所有其他服务(手动使用 VS 2017)。为了避免该步骤,我尝试使用以下命令创建一个批处理文件,以使用 IISExpress 托管我的 ASP.NET Core Web API。

dotnet build 
"C:\Program Files (x86)\Microsoft Visual Studio17\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

上面的命令有没有问题?

你还必须设置环境变量,我在下面的博客post,

中清楚地记录了这一点

https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3