aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Access HTML pages throws InvalidDataException

Open hishamco opened this issue 1 month ago • 7 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe the bug

Accessing an HTML page throws System.IO.InvalidDataException: 'The archive entry was compressed using an unsupported compression method.'

Expected Behavior

The HTML page shows up

Steps To Reproduce

  1. Create an ASP.NET Core Web Application
  2. Place an html file inside wwwroot folder
  3. Run the app then access the file

Exceptions (if any)

System.IO.InvalidDataException: 'The archive entry was compressed using an unsupported compression method.'

.NET Version

.NET 10.0

Anything else?

No response

hishamco avatar Nov 20 '25 06:11 hishamco

A full stack trace for the error would be useful.

martincostello avatar Nov 20 '25 07:11 martincostello

dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]
      Middleware loaded
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16521 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0]
      Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5064
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\hisha\OneDrive\Desktop\WebApplicationDemo
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[1]
      Response markup is scheduled to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[2]
      Response markup was updated to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Script injected: /_framework/aspnetcore-browser-refresh.js
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[1]
      Response markup is scheduled to include browser refresh script injection.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HNH811PEBQ1J", Request id "0HNH811PEBQ1J:00000001": 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)

hishamco avatar Nov 20 '25 07:11 hishamco

@hishamco thanks for contacting us.

@MackinnonBuck seems there's something broken here

javiercn avatar Nov 20 '25 10:11 javiercn

Removing MapAssests() and WithAssets() then using app.UseStaticAssets() let the application fine

hishamco avatar Nov 20 '25 13:11 hishamco

I get the same error - but I can't find UseStaticAssets as the workaround?

tankbob avatar Dec 01 '25 10:12 tankbob

UseStaticFiles() instead

hishamco avatar Dec 01 '25 17:12 hishamco

I get the same error, but only in Development Environment (Visual Studio 2026)

BeniFreitag avatar Dec 10 '25 09:12 BeniFreitag