Using middleware on ASP.NET Core 3.0 and later
In ASP.NET Core 3.0 and later, the Configure()
method looks different. There are two new kinds of middleware elements, called UseRouting
and UseEndpoints
:
public void Configure(IApplicationBuilder app, Â Â IWebHostEnvironment env) { Â Â Â Â if (env.IsDevelopment()) Â Â Â Â { Â Â Â Â Â Â Â Â app.UseDeveloperExceptionPage(); Â Â Â Â } Â Â Â Â app.UseRouting(); Â Â Â Â app.UseEndpoints(endpoints => Â Â Â Â { Â Â Â Â Â Â Â Â endpoints.MapGet("/", async context => Â Â Â Â Â Â Â Â { Â Â Â Â Â Â Â Â Â Â Â await context.Response.WriteAsync("Hell World!"); Â Â Â Â Â Â Â Â }); Â Â Â Â }); }
The first one is a middleware that uses...