public void Configure(IApplicationBuilder app, IWebHostEnvironment env,ILogger<Startup> logger)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Use(async (context, next) =>
{
context.Response.ContentType = "text/plain;charset=utf-8";
logger.LogInformation("M1:传入请求");
await next();
logger.LogInformation("M1:传出响应");
});
app.Use(async (context, next) =>
{
context.Response.ContentType = "text/plain;charset=utf-8";
logger.LogInformation("M2:传入请求");
await next();
logger.LogInformation("M2:传出响应");
});
app.Run(async (context) =>
{
await context.Response.WriteAsync("M3:处理请求,并生成响应");
logger.LogInformation("M3:处理请求,并生成响应");
});
}