You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/static-files.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,7 @@ To disable this behavior, set `EnableStaticAssetsDevelopmentCaching` to `true` i
152
152
153
153
## Static files in non-`Development` environments
154
154
155
-
When running an app locally, static web assets are only enabled in the `Development` environment. To enable static files for environments other than Development during local development and testing (for example, in the `Staging` environment), call <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseStaticWebAssets%2A> on the <xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder>.
155
+
When running an app locally, static web assets are only enabled in the `Development` environment. To enable static files for environments other than `Development` during local development and testing (for example, in the `Staging` environment), call <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseStaticWebAssets%2A> on the <xref:Microsoft.AspNetCore.Builder.WebApplicationBuilder>.
156
156
157
157
> [!WARNING]
158
158
> Call <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseStaticWebAssets%2A> for the ***exact environment*** to prevent activating the feature in production, as it serves files from separate locations on disk *other than from the project*. The example in this section checks for the `Staging` environment with <xref:Microsoft.Extensions.Hosting.HostEnvironmentEnvExtensions.IsStaging%2A>.
@@ -171,7 +171,7 @@ if (builder.Environment.IsStaging())
171
171
When <xref:Microsoft.AspNetCore.Hosting.IWebHostEnvironment.WebRootPath%2A?displayProperty=nameWithType> is set to a folder other than `wwwroot`, the following default behaviors are exhibited:
172
172
173
173
* In the `Development` environment, static assets are served from `wwwroot` if assets with the same name are in both `wwwroot` and a different folder assigned to <xref:Microsoft.AspNetCore.Hosting.IWebHostEnvironment.WebRootPath%2A>.
174
-
* In any environment other than development, duplicate static assets are served from the <xref:Microsoft.AspNetCore.Hosting.IWebHostEnvironment.WebRootPath%2A> folder.
174
+
* In any environment other than `Development`, duplicate static assets are served from the <xref:Microsoft.AspNetCore.Hosting.IWebHostEnvironment.WebRootPath%2A> folder.
175
175
176
176
Consider a web app created from the empty web template:
177
177
@@ -189,7 +189,7 @@ var builder = WebApplication.CreateBuilder(new WebApplicationOptions
189
189
By default, for requests to `/`:
190
190
191
191
* In the `Development` environment, `wwwroot/Index.html` is returned.
192
-
* In any environment other than development, `wwwroot-custom/Index.html` is returned.
192
+
* In any environment other than `Development`, `wwwroot-custom/Index.html` is returned.
193
193
194
194
To ensure assets from `wwwroot-custom` are always returned, use ***one*** of the following approaches:
0 commit comments