IIS fails to run ASP.NET Core site - HTTP Error 502.5
Your problem is a bad web.config file:
<aspNetCore requestTimeout="02:00:00"
processPath="%LAUNCHER_PATH%"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false" />
The path %LAUNCHER_PATH% does not exist on your system, it is not even valid. It should be something like:
<aspNetCore requestTimeout="02:00:00"
processPath=".\yourAppName.exe"
arguments="somePossibleArgument"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false" />
Notice that the web.config file is completely ignored if the app is launched from the command line, that's why you do not receive the error.
I had this same problem, My issue were IIS was not able get the path to dotnet. I was able to fix it by specifying the path to the dotnet.exe
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\your-project.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"/>
</system.webServer>
</configuration>
My problem was that the process wouldn't start due to an invalid escape sequence in my appsettings.json
file.
I'm using dotnet to run the published ASPNET Core 2 web api dll. The problem was revealed by opening a command prompt and navigating to the directory where the site files are located. Once there, I ran the command:
dotnet mySite.dll
(change mySite.dll to the main dll of your app. Also, make sure the correct version of the .NET Core Windows Server Hosting bundle is already installed).
Pressing enter, it immediately crashed giving the exact feedback in the console window of what was wrong. That's a great way to help determine your startup error(s) if you are having similar troubles.