I am having trouble running my ASP.NET5 from command line under IISExpress.
My current command line setup (thanks to this answer) looks like so
iisexpress.exe /config:"[project_dir].vs\config\applicationhost.config" /site:"WebUI" /apppool:"Clr4IntegratedAppPool"
Note that running the project from within VS2015 works fine.
When I run the command above, IISExpress starts up, it even finds the correct port it should run under. The main problem is every request returns a 502.3.
Looking at the contents of IISExpress\TraceLogFiles
I see this error
ModuleName: httpPlatformHandler
Notification: EXECUTE_REQUEST_HANDLER
HttpStatus: 502
HttpReason: Bad Gateway
HttpSubStatus: 3
ErrorCode: The server is currently disabled. (0x8007053d)
What is causing this? Why can't I get this to run!?
As the earlier answer points out, Visual Studio sets %LAUNCHER_PATH% and %LAUNCHER_ARGS% environment variables when launching iisexpress. If you set these, you don't have to run dotnet publish
, however the contents of these arguments changes slightly from version to version of Visual Studio. Luckily, you can use Process Explorer to see what's in there. Quoting a good blog post on this:
https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3
So in fact Visual Studio silently adds the two environment variables when launching IIS Express, so that ASP.NET Core related bits can be injected.
LAUNCHER_ARGS: -debug -p “C:\Program Files\dotnet\dotnet.exe” -a “exec \”C:\Users\lextm\documents\visual studio 2017\Projects\WebApplication2\WebApplication2\bin\Debug\netcoreapp1.0\WebApplication2.dll\”” -pidFile “C:\Users\lextm\AppData\Local\Temp\2\tmpFD6D.tmp” -wd “C:\Users\lextm\documents\visual studio 2017\Projects\WebApplication2\WebApplication2”
LAUNCHER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe```
When I ran into this issue (I had to use iisexpress instead of just dotnet run
since I was running an application with legacy components), I set LAUNCHER_ARGS="-p C:\$XXX\$MY_PROGRAM.exe" and LAUNCHER_PATH: to the above, and launching the application worked for me. I recommend using Process Explorer to find what Visual Studio is putting in there, and using that to craft a launch command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With