Reputation: 23
I'm trying to publish a .NET Core 5.0 application to IIS but I get an error:
HTTP Error 500.31 - Failed to load ASP.NET Core runtime
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.Troubleshooting steps:
- Check the system event log for error messages
- Enable logging the application process' stdout messages
- Attach a debugger to the application process and inspect
My web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\AppCore.dll" stdoutLogEnabled="false" hostingModel="inprocess" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
.NET info:
I have installed the ASP.NET Core Runtime 5.0.17 Hosting Bundle. I need to stay on .NET 5 for now for a client's requirement.
Upvotes: 1
Views: 21639
Reputation: 9247
There could be any number of errors during start up that is causing your problem. When I first faced this issue, enabling logging and viewing that put me in the right direction.
Enable logging by editing your deployed web.config file.
<aspNetCore processPath="dotnet"
arguments=".\AppCore.dll"
stdoutLogEnabled="true" *** <<< change this
hostingModel="inprocess"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>
Then ...
Upvotes: 5