'HTTP Error 500.19 - Internal Server Error: The requested page cannot be accessed because the related configuration data for the page is invalid

I'm trying to publish a .NET 6 Blazor WebAssembly WASM locally to IIS

I'm using Visual Studio 2022 on Windows 10

I have the .NET 6 hosting bundle installed

I'm using the default Blazor Web Assembly template installed with Visual Studio with no modifications

When I navigate to localhost I get the HTTP 509.1 Error, which indicates a malformed web.config

(Image) HTTP Error 509.1

Here is my web.config:

(Image) web.config

If I comment out the rewrite section as follows:

(Image) web.config with offending lines commented out

IIS no longer throws an exception, however it sends me to the default IIS page

Any ideas how to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source