使用命令行调用 IISExpress 来托管 ASP.NET Core 应用程序 [英] Invoking IISExpress using command line to host ASP.NET Core App
问题描述
我有一个依赖于许多其他服务的服务,在开发期间,我只是启动所有其他服务(手动使用 VS 2017).为了避免该步骤,我尝试使用以下命令创建一个批处理文件,以使用 IISExpress 托管我的 ASP.NET Core Web API.
I have a service that depends on lot of other services, during the development time, I just start all other services (manually using VS 2017). In order to avoid that step, I am trying to create a batch file with the below command to Host my ASP.NET Core Web API using IISExpress.
dotnet build
"C:Program Files (x86)Microsoft Visual Studio2017ProfessionalCommon7IDEExtensionsMicrosoftWeb ToolsProjectSystemVSIISExeLauncher.exe" -p "C:Program Filesdotnetdotnet.exe" -a "exec ".ServiceinDebug
etcoreapp2.0MyService.dll"" -pidFile [System.IO.Path]::GetTempFileName() -wd "."
从 PS 命令提示符(管理员)调用批处理文件时,出现以下错误
When invoking the batch file from PS command prompt(Administrator) I am getting the below error
无法启动进程:C:Program Filesdotnetdotnet.exe
Failed to launch processs: C:Program Filesdotnetdotnet.exe
最后一个错误 = 267
Last error = 267
上面的命令有什么问题吗?
Is there anything wrong with the above command?
推荐答案
你还必须设置环境变量,我在下面的博客文章中清楚地记录了这一点,
You have to also set environment variables, which I documented clearly in the following blog post,
这篇关于使用命令行调用 IISExpress 来托管 ASP.NET Core 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!