Last active
September 3, 2023 20:33
-
-
Save dj-nitehawk/171a4228be267ca9312e1ae882ee6d5b to your computer and use it in GitHub Desktop.
Middleware order for Blazor Serverside
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints; | |
using FastEndpoints.Swagger; | |
var bld = WebApplication.CreateBuilder(args); | |
bld.Services.AddFastEndpoints(); | |
bld.Services.AddRazorPages(); | |
bld.Services.AddServerSideBlazor(); | |
bld.Services.SwaggerDocument(); | |
var app = bld.Build(); | |
app.UseStaticFiles(); | |
app.UseAuthorization(); | |
app.UseFastEndpoints(); | |
app.UseSwaggerGen(); | |
app.MapBlazorHub(); | |
app.MapFallbackToPage("/_Host"); | |
app.Run(); |
sorry! the snippet hadn't been updated for the latest FE.
pls try the above now and report back.
here's the sample project i tried it on: Sample.zip (right click > save as > rename to .zip > extract)
Yes, it worked. I tried version 5.16 yesterday, it didn't work. Trying with 5.17 is positive. Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I set up the project this way but I still keep getting errors.
Excepted Unhandled:
throw new InvalidOperationException("Endpoints are not initialized! This usually happens when 'app.UseFastEndpoints()' is placed after 'app.MapControllers()'. Try changing the middleware order.");