[backend/middleware] Return 404 instead of 500 when framework file is not found
This commit is contained in:
parent
3f1fb87aab
commit
d2e3a89046
1 changed files with 5 additions and 0 deletions
|
@ -77,6 +77,11 @@ public static class WebApplicationBlazorFrameworkExtensions
|
||||||
});
|
});
|
||||||
subBuilder.UseMiddleware<ContentEncodingNegotiator>();
|
subBuilder.UseMiddleware<ContentEncodingNegotiator>();
|
||||||
subBuilder.UseStaticFiles(options);
|
subBuilder.UseStaticFiles(options);
|
||||||
|
subBuilder.Use(async (HttpContext context, RequestDelegate _) =>
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
await context.Response.StartAsync();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|
Loading…
Add table
Reference in a new issue