MapStaticAssets doesn't work with WebApplication.CreateSlimBuilder #58986
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-static-web-assets
Describe the bug
In an app built with
WebApplication.CreateSlimBuilder()
and using the newMapStaticAssets
in .NET 9, responses for static files are empty with 200 status code. To reproduce, create a new ASPNET Core project from template, then changeWebApplication.CreateBuilder()
toWebApplication.CreateSlimBuilder()
in Program.cs.It appears that calling
UseStaticWebAssets
allows this to work, but this isn't documented as far as I can tell.Would like to understand what is expected and what the correct setup should be. It seems that if
CreateSlimBuilder
alone isn't sufficient, there should be some kind of warning visible to developer. At the very least, this aspect should be documented.Expected Behavior
Either
MapStaticAssets
truly works as a "drop-in replacelement" ofUseWebStaticFiles
, or incompatbilities are documented and/or warned to developer in tooling/build..NET Version
9.0.100
The text was updated successfully, but these errors were encountered: