示例
1、更新Program.cs
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
});
app.Run();
如果未定义Attribute路由,使用此路由,如果定义了Attribute路由,使用Attribute路由。
Gitee获取源码:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
});
app.Run();
如果未定义Attribute路由,使用此路由,如果定义了Attribute路由,使用Attribute路由。
Gitee获取源码: