Skip to content

Conversation

@Tratcher
Copy link
Member

@Tratcher Tratcher commented Sep 30, 2022

Fixes #38481

AspNetCore only serves static files from the wwwroot subfolder by default. This is different from ASP.NET Framework that served from the root directory by default.

Currently there's no warning or error if the wwwroot directory does not exist.

This adds xml docs to clarify the default, and logs warning if the wwwroot directory is missing and you have a StaticFile middleware.

@davidfowl
Copy link
Member

TODO: Should this only log from the StaticFileMiddleware constructor instead?

Yes.

@Tratcher Tratcher force-pushed the tratcher/staticfiledocs branch from cd56f51 to b2e73e6 Compare October 4, 2022 23:11
Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test log is written?

@Tratcher Tratcher requested a review from JamesNK October 5, 2022 19:10
@Tratcher Tratcher merged commit 25ffef8 into dotnet:main Oct 6, 2022
@Tratcher Tratcher deleted the tratcher/staticfiledocs branch October 6, 2022 15:31
@ghost ghost added this to the 8.0-preview1 milestone Oct 6, 2022
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UseStaticFiles should display the default PhysicalFileProvider default path when using a constructor that doesn't override the default IFileProvider

4 participants