简体   繁体   中英

Getting 500 Error code from asp.net core app on iis 8.5 windows server 2012 but works fine on console

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 ie "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:

  • It had dotnet-core RC1 installed (which I uninstalled before deployment process)
  • HttpPlatformHandler module was registered in IIS modules (which I removed but still doesn't work)
  • OS is Windows Server 2012 (whereas the other machines are 2008 and 2012 R2)

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.

  • Created a app_offline.htm file but same result
  • iisreset (multiple times, wheneve I made a change in IIS)
  • Restarted the machine (2 times only)
  • Re-installed the asp net core module (manually and repair it)
  • Granted Read,Write,Execute access to Default AppPool{{ApplicationName} in that folder
  • Changed Application Pool Identity to Admin user

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM