4

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 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 ".\"

When invoking the batch file from PS command prompt(Administrator) I am getting the below error

Failed to launch processs: C:\Program Files\dotnet\dotnet.exe

Last error = 267

Is there anything wrong with the above command?

Thangadurai
  • 2,573
  • 26
  • 32

1 Answers1

4

You have to also set environment variables, which I documented clearly in the following blog post,

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

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • Thanks, I tried to set this environment variables, but after that what I need to do to start the IISExpress? I tried calling IISExpress.exe as well as VSIISExeLauncher.exe without any arguments, but that didn't start the app that I specified in the environment variables. – Thangadurai Nov 06 '17 at 05:17
  • I got it. With few trial and errors, I am able to host the app on IISExpress. – Thangadurai Nov 06 '17 at 05:40
  • 3
    Hi @Thangadurai, I stumbled upon your question when trying to run IIS Express from the command line for a .NET Core application. Would you mind sharing what you did to make it work in the end? – Farzad Dec 05 '17 at 22:54