Error 500.19 Internal server error on IIS - asp.net

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.

Related

HTTP Error 500.19 - internal server error code 0x8007000d

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

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.

Blazor Hosted (ASP.NET) HTTP Error 500.19 - Internal Server Error

From what I understand this error occurs when the web.config is not configured properly. However when I publish the app the following web.config gets generated
<?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=".\Lotus.Server.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 85a43eb6-3576-401d-b025-a15a2cc377b6-->
I first thought of installing URL Rewrite, this did not solve the problem. I am stressing out have tried almost everything any ideas on how to resolve it?
The error page looks like this:
I had this same problem and I was trying to fix it for 4 days. Then I found the solution.
Firstly you need to download dotnet hosting 2.2.2
https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-2.2.2-windows-hosting-bundle-installer
Then after instalation try to restart IIS with cmd (run as admin and then write iisreset).
If error page has changed we are going in good direction :)
Now it should say that you are using wrong module (which indeed is true).
Open IIS, get to your website and check installed modules. On list you should be able to see AspNetCoreModule but not AspNetCoreModuleV2.
go to:
%ProgramFiles%\IIS\Asp.Net Core Module\V2\
and copy aspnetcorev2.dll
Then go into %SystemRoot%\system32\inetsrv\ and paste it
Now after this, open config folder in %SystemRoot%\system32\inetsrv\ and then open applicationHost.
IMPORTANT
At this stage you need to turn off your iis
Now find this line:
<add name="AspNetCoreModule" image="%SystemRoot%\system32\inetsrv\aspnetcore.dll" />
and add under it:
<add name="AspNetCoreModuleV2" image="%SystemRoot%\system32\inetsrv\aspnetcorev2.dll" />
And this same goes with this one:
<add name="AspNetCoreModule" />
add under it:
<add name="AspNetCoreModuleV2" />
Now save it, overwrite old one, and enable IIS. Go to your website, check modules and at the list you should be able to see AspNetCoreModuleV2:
AspNetCoreModule and AspNetCoreModuleV2 on list
For me It was lacking the Url Rewrite Module
https://www.freecodecamp.org/news/how-to-deploy-a-blazor-application-on-internet-information-services-iis-f96f2969fdcb/
Fixed this by changing "AspNetCoreModuleV2" to "AspNetCoreModule" in the generated web.config in my publish folder, i.e., from
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
to
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
This had me scratching my head for a while as everything was working fine on LocalHost - the error occured on the production server.
After rebuilding the site I realised that I had deleted the site folder on the production server along with its contents.
When I replaced the site I had posted it to my server node without recreating the site folder, so obviously the server couldn't access my web.config file as it was unbable to find the site folder.
Lesson learnt! Hope it saves other running down the 500.19 rabbit hole.

Invalid web.config causes HTTP 502.5 error

I am trying to deploy an Asp.net boilerplate app on azure and I have already deployed my backend and the Swagger application is working fine, when I try to also deploy the Angular frontend I keep getting this error: HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure.
I have found other threads discussing this problem, but since I am using the ASP.NET Boilerplate framework i do not have a .exe or .dll file that I can run to start the Web.Host project, not that I'm aware of atleast.
The logs in Kudu show this: Application '/LM/W3SVC/288745522/ROOT' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%'.
It probably has something to do with those %LAUNCHER% variables not being found, I have found some other threads suggesting your should replace the LAUNCHER_ROOT [projectname].exe or [projectname].dll but I cant seem to find these in my project. This might be because of the way ASP.NET Boilerplate is built up.
This is my web.config:
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
<environmentVariables />
</aspNetCore>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Error message indicates that the ASP.NET Core Module attempts to start the worker process but it fails to start. The cause of a process startup failure can usually be reviewed from entries in the Application Event Log and the ASP.NET Core Module stdout log. Both logs can be found on the Kudu/SCM site in d:\home\Logfiles. In your web.config file located in the wwwroot folder, enable stdout logs, as so:
Web.config sample:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApplicationAssembly.dll" stdoutLogEnabled="true"
stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Please check the eventlog.xml and the stdout logs you have collected.
Reference: https://blogs.msdn.microsoft.com/waws/2018/06/10/troubleshooting-http-502-5-startup-issues-in-azure-appservice-for-asp-net-core-websites/
Additional troubleshooting methods for ASP.Net at
https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-2.2#troubleshoot-on-azure-app-service.
Hope it helps.

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

Resources