I used angular .net core 2.2 template to build application.In localhost working fine,When i host to IIS Im getting this error.Im using IIS 10 to host the application.
<Install .Net Core 2.2 run-time bundle on hosting machine.
Or
Publish your project as self-contained.
I had this problem just a second ago. I replaced my code part in web.config with this.
OLD PART:
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2"
resourceType="Unspecified" />
</handlers>
NEW PART:
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule"
resourceType="Unspecified" />
</handlers>
There are a couple ways you can fix this:
applicationhost.config
file used by your IIS. You should have the following entry in its appropriate locations:<configuration>
<system.webServer>
...
<globalModules>
...
<add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />
</globalModules>
</system.webServer>
...
<location path="" overrideMode="Allow">
<system.webServer>
<modules>
...
<add name="AspNetCoreModuleV2" lockItem="true" />
</modules>
</system.webServer>
</location>
</configuration>
Just make sure you actually have the file for aspnetcorev2.dll
in your IIS bin directory.
Here is what worked for me:
<add name="AspNetCoreModuleV2" image="%ProgramFiles%\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll" />
Windows IIS
Solution: Install the hosting bundle.
Reason: Although the SDK normally contains the runtime, however, it seems the SDK installer is not registering the runtime correctly on the server.
Workaround (not recommended):
Change AspNetCoreModuleV2
to AspNetCoreModule
inside web.config.
Azure platform hosting
Install the .NET Core runtime extension by selecting Extensions and then installing .NET Core Runtime.
ASP.NET Core 2.2 or later: For a 64-bit (x64) self-contained deployment that uses the in-process hosting model, disable the app pool for 32-bit (x86) processes.
In the Actions sidebar of IIS Manager > Application Pools, select Set Application Pool Defaults or Advanced Settings. Locate Enable 32-Bit Applications and set the value to False.
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.0#create-the-iis-site