Reputation: 23042
I have an asp.net core 2.0 hosted locally on IIS 10. For some reason DefaultAppPool keeps stopping as soon as I hit the hosted website. And I am getting HTTP Error 503. The service is unavailable.
In event logs I see following error;
The Module DLL C:\WINDOWS\system32\inetsrv\aspnetcore.dll failed to load. The data is the error.
When I check the path C:\WINDOWS\system32\inetsrv\
I do not see aspnetcore.dll
exists. Should it be there? If yes, .net core installation exe shouldn't be copy it?
Here are some information below;
What I tried, and did not worked?
Any idea how I can fix this?
Upvotes: 1
Views: 8730
Reputation: 355
This issue may happen if setting up a new windows machine with IIS and then restoring it's previous settings and configurations. The module aspnetcore.dll is not used anymore and even installing the latest version of Dotnet Hosting Bundle will not solve the issue because that file is not installed anymore. The new IIS module version AspNetCoreModuleV2 and the installed file is aspnetcorev2.dll and usually, is installed in the "%ProgramFiles%\IIS\Asp.Net Core Module" folder.
The solution is to edit applicationhost.config inside the C:\Windows\System32\inetsrv\config folder and remove all references to the old dll. Also in IIS, check the Modules for each website and remove any reference to the old module as well.
Restart IIS and the issue should be solved. If not, check the Windows Event Viewer to check if the error "The Module DLL C:\WINDOWS\system32\inetsrv\aspnetcore.dll failed to load." still happens.
Upvotes: 0
Reputation: 6508
I got this issue one time. Reason was Server OS was x64 base and target run time of installer was win-x86. In the publish wizard, win-x86 is the default option for Target Run time. Theoretically x86 application should work in x64. But after deploying the win-x64 , issue resolved.
Upvotes: 1
Reputation: 11
I also had this problem in Windows server 2012 R2
I found this answer: ASP.NET Core/.NET Core: Runtime & Hosting Bundle (latest versions) depends on Microsoft Visual C++ 2015 Redistributable
Upvotes: 1
Reputation: 7792
For hosting .Net Core applications in IIS, .Net CLR Version of application pool should be No Managed Code as shown in below screenshot. If you don't see "No Managed Code" option in in dropdown then you need to install .Net Core Hosting Bundle.
Upvotes: 2
Reputation: 4236
Ensure you have .NET Core Hosting Bundle installed as mentioned here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
Upvotes: 1