Headline:
Getting 500 Error Code when running asp.net core application on windows server 2012 IIS 8.5 but works fine when executed from command line by specifying the generated exe file i.e. "MyApplication.exe"
Details:
Its not generating any error logs and there is nothing related to this in Windows event viewer so I am clueless what is happening. I am pretty sure that problem is not in the generated package (using dotnet publish) because it is generated through TeamCity and then the same package is deployed to different machines and the process to create the host site is also automated using OctopusDeploy and this works on other machines. Things which are different on the machine where it is not working are:
I did the following things but it always gave me 500 Error code and no errors in the log and no relevant events in windows event viewer.
I think the issue is somewhere between IIS and aspnet core module because this app does work in console. And I am also sure that web.config is correct because the same is working on other two machines btw in web.config it is instructed to run ".{{MyApplication}}.exe"
Any help will be highly appreciated as I've spent my whole day on it and really don't have any energy left to do this again tomorrow.
I fixed my own problem. Here is the solution if someone is having the same problem.
The application pool for dotnet core app has no managed code
selected BUT also make sure that Managed pipeline mode
is set to Classic