Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

enter image description here

like image 665
Panayiotis Paddy Paschalides Avatar asked Jul 12 '26 03:07

Panayiotis Paddy Paschalides


2 Answers

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

https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/hosting-bundle?view=aspnetcore-7.0#direct-download-current-version

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][1] [1]: https://i.sstatic.net/jC0JC.png

like image 155
cebilon Avatar answered Jul 13 '26 18:07

cebilon


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/

like image 36
Daniel Avatar answered Jul 13 '26 18:07

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!