I created an ASP.NET Core 5.0 Web API project. I can execute and run the application in IIS Express. If I deploy the app, then I get the following error:
Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error
HRESULT: 0x8007000d
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.
The official MS support page referenced two causes:
This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can't identify the XML elements of the modules that are not installed. For example, IIS URL Rewrite module.
Resolution
Use one of the following methods:
Delete the malformed XML element from the ApplicationHost.config or Web.config file. Check the unidentified XML elements, and then install the relevant IIS modules.
I installed IIS URL Rewrite module without a effect.
My web.config comes with my build/deploy process. For configurations I use the appsettings.json. So I don't know if and what have propably to change in my web.config. Any suggestions?
...\inetpub\wwwroot\MyApi\web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: f659debd-cac7-4ce5-b2fe-d1a440a87811-->
You should install hosting bundle version of .Net to add support .Net core runtime in IIS on server
all downloads: https://dotnet.microsoft.com/en-us/download/dotnet/5.0