4

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. enter image description here

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-->
Lex Li
  • 60,503
  • 9
  • 116
  • 147
Hölderlin
  • 424
  • 1
  • 3
  • 16
  • Does this answer your question? [asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)](https://stackoverflow.com/questions/49034308/asp-net-core-web-api-published-in-iis-after-moved-to-different-iis-server-pc-giv) – Lex Li Jan 14 '22 at 15:56

1 Answers1

9

You should install hosting bundle version of .Net to add support .Net core runtime in IIS on server

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-5.0.13-windows-hosting-bundle-installer

all downloads: https://dotnet.microsoft.com/en-us/download/dotnet/5.0

Saeid Doroudi
  • 935
  • 1
  • 9
  • 25