As the original issue (#44491) was closed, I'm opening a follow up issue.
Context
Hosted Blazor WebAssembly
The following two middleware pipeline definitions behave differently.
app.MapRazorPages();
app.MapControllers();
app.MapFallbackToFile("index.html");
and
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapControllers();
endpoints.MapFallbackToFile("index.html");
});
The first code chunk works well in all environments. The second works only in Development environment, unless builder.WebHost.UseStaticWebAssets(); is enabled.
Questions
- Can you help me better understand the difference between the two code chunks above? Why is the call to
endpoints.UseStaticWebAssets not necessary with the first code, but is necessary with the second code?
- Is it safe to enable
builder.WebHost.UseStaticWebAssets(); in Production environment? Documentation advises against enabling this in production for Blazor Server apps. Is the recommendation different for WebAssembly apps? Why?
- If it is not safe to enable, is there any other way to serve multiple Clients from one Server app?
As the original issue (#44491) was closed, I'm opening a follow up issue.
Context
Hosted Blazor WebAssembly
The following two middleware pipeline definitions behave differently.
and
The first code chunk works well in all environments. The second works only in Development environment, unless
builder.WebHost.UseStaticWebAssets();is enabled.Questions
endpoints.UseStaticWebAssetsnot necessary with the first code, but is necessary with the second code?builder.WebHost.UseStaticWebAssets();in Production environment? Documentation advises against enabling this in production for Blazor Server apps. Is the recommendation different for WebAssembly apps? Why?