Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How do I serve static html pages in .NET 10 Blazor WebAssembly?

$
0
0

I created a new .NET 10 Standalone Blazor WebAssembly App and added a static html page to the wwwroot folder. I then run the app in Visual Studio 2026 debug. The basic web assembly app runs and the sample pages work as expected. However, if I try to navigate to the static html page. The server throws a 500 Internal Server Error and the page will not come up. If I link to images or JavaScript files under the wwwroot folder, they are served up as expected. Anyone else run into this? I'm sure I'm missing a simple setting or configuration somewhere.

To reproduce in Visual Studio 2026, simply create a new "Blazor WebAssembly Standalone App" using ".NET 10 (Long Term Support)". Once the wizard is complete, add a simple html page (see sample below) to the wwwroot folder of the project.

<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Hello World</title></head><body><h1>Hello World!</h1><p>This is a sample web page.</p></body></html>

Run the project in Debug. The browser will load the new WebAssembly App. Navigate to the added simple html page by typing in the address bar: https://localhost:7142/sample.html the debugger spits out the error message below:

fail: Microsoft.AspNetCore.Server.Kestrel[13]      Connection id "0HNHN8GM1E6K9", Request id "0HNHN8GM1E6K9:000001B1": An unhandled exception was thrown by the application.      System.IO.InvalidDataException: The archive entry was compressed using an unsupported compression method.         at System.IO.Compression.Inflater.Inflate(FlushCode flushCode)         at System.IO.Compression.Inflater.ReadInflateOutput(Byte* bufPtr, Int32 length, FlushCode flushCode, Int32& bytesRead)         at System.IO.Compression.Inflater.ReadOutput(Byte* bufPtr, Int32 length, Int32& bytesRead)         at System.IO.Compression.Inflater.InflateVerified(Byte* bufPtr, Int32 length)         at System.IO.Compression.DeflateStream.CopyToStream.WriteAsyncCore(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)         at System.IO.Pipelines.PipeReader.<CopyToAsync>g__Awaited|15_1(ValueTask writeTask)         at System.IO.Pipelines.PipeReader.CopyToAsyncCore[TStream](TStream destination, Func`4 writeAsync, CancellationToken cancellationToken)         at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()         at Microsoft.AspNetCore.Watch.BrowserRefresh.ResponseStreamWrapper.DisposeAsync()         at Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware.InvokeAsync(HttpContext context)         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

It is complaining about an archive entry was compressed using an unsupported compression method, but I'm not using compression for anything.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>