middleware pipeline misconfiguration issue
See original GitHub issueAlthough endpoints respond with correct status codes, all endpoints do not omit the content of the response body.
The upgrade was only a few changes I made. other than trivial code changes…
var builder = WebApplication.CreateBuilder(args);
await DB.InitAsync(
builder.Configuration["DatabaseName"],
MongoClientSettings.FromConnectionString(builder.Configuration["ConnectionString"]));
builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Console()
.ReadFrom.Configuration(ctx.Configuration));
builder.Services.AddScoped<IUserRepository, UserRepository>();
builder.Services.AddScoped<IPlannerRepository, PlannerRepository>();
builder.Services.AddScoped<ICourseRepository, CourseRepository>();
builder.Services.AddScoped<ICourseRetriever, CourseRetriever>();
builder.Services.AddCors();
builder.Services.AddFastEndpoints();
builder.Services.AddSwaggerDoc();
builder.Services.AddResponseCaching();
builder.Services.Configure<JsonOptions>(option =>
option.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase);
FirebaseApp.Create(new AppOptions
{
Credential =
GoogleCredential.FromFile(@"./anteater-pathway-71271-firebase-adminsdk-bgz2p-79df6c1846.json")
});
builder.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(option =>
{
option.Authority = builder.Configuration["Jwt:Firebase:ValidIssuer"];
option.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = builder.Configuration["Jwt:Firebase:ValidIssuer"],
ValidAudience = builder.Configuration["Jwt:Firebase:ValidAudience"]
};
});
var app = builder.Build();
app.UseSerilogRequestLogging();
app.UseCors(b => b.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
app.UseFastEndpoints();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseResponseCaching();
if (app.Environment.IsDevelopment())
{
app.UseOpenApi();
app.UseSwaggerUi3(s => s.ConfigureDefaults());
}
else
{
app.UseDefaultExceptionHandler();
}
app.Run();
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
middleware pipeline misconfiguration issue #32
Although endpoints respond with correct status codes, all endpoints do not omit the content of the response body. The upgrade was only a...
Read more >Understanding your middleware pipeline in .NET 6 with the ...
In this post I introduce the Microsoft.AspNetCore.MiddlewareAnalysis package and show how to use it to visualise the middleware in your .
Read more >Understanding your middleware pipeline with the ...
In this post, I will take a look at the Microsoft.AspNetCore.MiddlewareAnalysis package, which uses an IStartupFilter and DiagnosticSource to ...
Read more >Why is middleware not executed when there are multiple ...
Actually, it never runs, the breakpoint is never hit. The first call to app.UseEndpoints is where the routing is executed and controller methods ......
Read more >ASP.NET Core Middleware
Middleware is software that's assembled into an app pipeline to handle requests and responses. Each component: Chooses whether to pass the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok thanks! will push a fix soon…
awesome! will push 3.1.3 final in a few minutes.