我不能在.NET Core 3.1中使用像.NET Core 2.2中那样的简单路由。
.NET Core 3.1中的路由最后更改是什么?
在.NET 3中,您应该使用端点而不是路由
app.UseStaticFiles();
app.UseRouting();
//other middleware
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapRazorPages();
endpoints.MapHub<MyChatHub>();
endpoints.MapGrpcService<MyCalculatorService>();
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句