What is new in the latest versions of ASP.NET Core?
The main change for ASP.NET Core took place in version 3.0: the routing engine was factored out of the MVC engine and is now also available for other handlers. In previous versions, routes and routing were a part of the MVC handler and were added with app.UseMvc(....); this has now been replaced with app.UseRouting() and UseEndpoints(...), which can route requests not only to controllers but also to other handlers.
Endpoints and their associated handlers are now defined in UseEndpoints, as shown here:
app.UseEndpoints(endpoints =>
{
...
endpoints.MapControllerRoute("default", "
{controller=Home}/{action=Index}/{id?}");
...
});
MapControllerRoute associates patterns with controllers, but we may also use something such as endpoints.MapHub<ChatHub>("/chat"), which associates a pattern with a hub that handles WebSocket connections. In the previous...