liveBook · Manning

UseStaticFiles

UseStaticFiles is an ASP.NET Core application-builder method that adds middleware for serving static files from the application.

How 2 Manning books explain it

ASP.NET Core in Action, 3e

UseStaticFiles is an ASP.NET Core application-builder method that adds static-file serving middleware to the request pipeline.

How it is used
Adds static-file serving to an ASP.NET Core request pipeline.
How deep it goes
Explains registration, wwwroot lookup, successful responses, pass-through behavior, and automatic 404 handling.
Examples
Uses Program.cs, wwwroot/moon.jpg, missing.jpg, and browser responses to demonstrate serving and failure cases.
What you can do after
Operate/configure an ASP.NET Core pipeline that serves existing files and returns 404 responses for missing files.

Read how ASP.NET Core in Action, 3e explains UseStaticFiles →

Pro ASP.NET Core 7, Tenth Edition

UseStaticFiles is an ASP.NET Core application-builder method that adds static-file serving to the request pipeline.

How it is used
Adds static-file serving to the ASP.NET Core request pipeline, primarily for files under wwwroot.
How deep it goes
Explains default behavior, middleware ordering, response headers, configurable locations, URL prefixes, MIME handling, and multiple mappings.
Examples
Uses wwwroot files, a static.html request, and a PhysicalFileProvider mapping from /files to staticfiles.
What you can do after
Operate/configure static-file serving with default wwwroot behavior or customized file providers, URL prefixes, and response options.

Read how Pro ASP.NET Core 7, Tenth Edition explains UseStaticFiles →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.