HTTP Error 500.19 - internal server error code 0x8007000d - asp.net-core-webapi

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
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

Related

Error 500: Hosting .net Core 6 app into IIS on Windows Server 2016

Before opening this ticket, I read dozens of other questions here on StackOverflow, youtube etc, but all suggestions that I found not solve my problem.
What I intend is to host a .net core 6 web api on windows server 2016 using IIS.
I've managed to host a client site (Angular) without problems, but the API always gives me a 500.19 error:
I have configured port 5041, but I have already tried with others, such as 80, 8080 without success.
I already have installed the Asp.Net Core Runtime and Hosting Bundle:
This is my 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=".\EvoStats.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
I saw someone else who solved your problem by putting the full path of dotnet, I did that too, but it didn't solve in my case:
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" ...
I also configured the Application Pool to not manage the code using .net CLR
I don't know what I can do more :(
I appreciate your help.
I already managed to solve it.
The problem was with the access permissions to the wwwroot folder.
Something strange, because I have a site (Angular) working on this folder, before giving Full Control to the user IIS_IUSRS.
Hope this solution helps others.

Blazor WebAssembly on IIS 8 - 0x8007000d

I am following this guide in order to host my Blazor WebAssembly project: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/webassembly?view=aspnetcore-3.1#rewrite-urls-for-correct-routing
I have installed the URL Rewrite module 2.1 but I still receive this error:
HTTP Error 500.19 - Internal Server Error
Error Code: 0x8007000d
Config File \\?\C:\MyProject\web.config
I am pointing the Physical path to one step above wwwroot, i.e the root folder of my project after publish.
My web.config in root folder looks like this:
<?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=".\MyProject.Server.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
What am I missing? I have .NET Core 3.1.202 installed. My project is built upon the default template. Meaning an ASP.NET Core hosted Server part and WebAssembly-powered Client part. I am using port 81 for the IIS site.
Appreciate any guidance
Solved by installing the ASP NET Core hosting module: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1
On IIS 10 I had to install additional module - URL Rewrite: https://www.iis.net/downloads/microsoft/url-rewrite

HTTP 500 Error When Publishing Web App to IIS

I've been trawling through related questions for several weeks looking for an answer, and none of the previous solutions are working for me. I know this is a common (and vague) problem.
I'm hosting a web app in IIS on Windows Server 2016. The application is built in VS2019 and runs fine in IIS Express. The default web site hosted by IIS is working, but when I add a second site pointing to my published application, I'm getting a 500 error.
However, when I check the IIS logs, all I see are 200 responses, which is odd. There is also no error in Event Viewer to give me more details. The best lead I have found so far is that the problem may be caused by the web.config file.
The generated XML is this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MalechusDotCom.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: bc59438b-f089-4db2-98d6-cc60312db351-->
Is there anything else I can check to try to isolate the issue?
I got similar problem . setting dotnet exe complete path resolved my problem. Try this one:
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\MalechusDotCom.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
Update above line of code with complete processPath value. Make sure C:\Program Files\dotnet\dotnet.exe path exist in your system or find equivalent path. this vary system to system.

My ASP.NET Core app says it can't read web.config

I get this error when I access my app which I published to local IIS:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
My web.config is really simple:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\TreesOnMars.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 14bfa9ba-0bd6-4ae2-a6f4-6e3e91d35263-->
What could be wrong? I tried giving all users permission to read my c:\inetpub\wwwroot folder... the web.config doesn't have any obvious error in it! I tried some of the solutions at this question but they didn't work...
You need to install the .NET Core hosting bundle to host .NET Core apps in IIS. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The link to the .NET Core 2.1 hosting bundle is here: https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.3-windows-hosting-bundle-installer
Also make sure the following Windows features are enabled:
More information can be found here:
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x

Error 500.19 Internal server error on IIS

There are lots of questions about this message error, I tried all the proposed solutions but none of them worked
I have a ASP .NET webapp, I registered the app to IIS and when I visit the page I get this error:
HTTP Error 500.19 internal server error The requested page cannot be
accessed because the related configuration data for the page is
invalid
Error code is: 0x8007000d
I post my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\ReviewerServices.web.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true" />
</system.webServer>
</configuration>
Here what I tried:
issuing the command "aspnet_regiis.exe -i" after the installation
assigning full permissions to the entire folder to the user IUSR and IIS_IUSRS
checking the web.config for syntax errors (none found)
tried to fudge a little bit the web.config file (looking for non printable ascii, encoding format and such)
It is so carefully documented by Microsoft in a step by step way,
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis
You forgot to install ASP.NET Core Module for IIS.

Resources