Skip to content

Instantly share code, notes, and snippets.

@dj-nitehawk
Last active September 3, 2023 20:33
Show Gist options
  • Save dj-nitehawk/171a4228be267ca9312e1ae882ee6d5b to your computer and use it in GitHub Desktop.
Save dj-nitehawk/171a4228be267ca9312e1ae882ee6d5b to your computer and use it in GitHub Desktop.
Middleware order for Blazor Serverside
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();
@dj-nitehawk
Copy link
Author

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)

@erdikalleci
Copy link

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