I'm having issues deploying .NET Core applications to IIS on a Windows 10 machine.
When I deploy to IIS and navigate to the site I recieve the message:
"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 For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526
In my event viewer, every call to the page generates 3 error messages.
Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.
Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Failed to start application '/LM/W3SVC/4/ROOT', ErrorCode '0x8000ffff'.
On these alone, I'd go down the rabbit hole of thinking there's some issue in the build of the project or perhaps my installation of some .NET Core package except:
I think there must be some issue with how I've configured IIS, the sites, or the application pools, but as best I can tell there isn't any difference. If anyone has encountered this, I'm all ears for suggestions.
In my case, the target machine was missing the ASP.NET Core runtime itself.
Issue is resolved after installing the Hosting Bundle from https://dotnet.microsoft.com/download/dotnet-core/3.1
Using the tool suggested (and created) by @LexLi I was able to determine the issue was caused by the application pool not having permissions to the site folder. Giving it permissions fixed the issue. This was not clear from the error messages. Answered here in case anyone else experiences the same error message.
I was getting the same error messages for a new .NET Core 3.1 framework-dependent web app on an IIS server which was already hosting other .NET Core 3.1 framework-dependent web apps with no problem. The messages in Event Viewer were slightly different; but also very hard to find - sometimes I couldn't see any events which seemed to relate.
If I converted the site to stand-alone "win-x86", it worked; but stand-alone "win-x64" didn't work.
After days of...
dotnet --infoon the IIS server,
dotnet --infoon the build server,
...this turned out to be an AppPool setting.
In the AppPool's Advanced Settings, there is an "Enable 32-Bit Applications" setting, which IIS considers the default to be False; but on mine was True. Toggling this setting caused the site to work and fail, when False and True, respectively.
It had been set to True on my site because we use octopusdeploy to deploy our site, and the "IIS AppPool – Create" step has an option relating to this setting; but in Octopus, the default value is True, so this needed turning off.
User contributions licensed under CC BY-SA 3.0