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
[area-blazor] Failed to run Blazor web App with Exception: "Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery" after installing 11.0 Preview 7 #67628
Actual Result
Webpage failed to load with "InvalidOperationException: Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery."
Note
This issue also reproduces on 11.0 Blazor Web (webassembly/Auto) app
This issue does not reproduces on Blazor WebAssembly Standalone app.
Workaround: add app.UseAntiforgery(); in Program.cs file.
Stack:
System.InvalidOperationException: Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery.
Configure your application startup by adding app.UseAntiforgery() in the application startup code. If there are calls to app.UseRouting() and app.UseEndpoints(...), the call to app.UseAntiforgery() must go between them. Calls to app.UseAntiforgery() must be placed after calls to app.UseAuthentication() and app.UseAuthorization().
at Microsoft.AspNetCore.Routing.EndpointMiddleware.ThrowMissingAntiforgeryMiddlewareException(Endpoint endpoint)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
REGRESSION INFO: Works well on 11.0 Preview 6
INSTALL STEPS:
Platform
Repro Steps
Actual Result

Webpage failed to load with "InvalidOperationException: Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery."
Note
app.UseAntiforgery();in Program.cs file.Stack: