asp.net core 添加区域(Areas)遇到的问题

it2022-05-05  171

asp.net core 添加区域(Areas)后运行的时候报“InvalidOperationException: The constraint reference 'SPA' could not be resolved to a type. Register the constraint type with 'Microsoft.AspNetCore.Routing.RouteOptions.ConstraintMap'.”的错误。

后来发现

app.UseMvc(routes =>         {           routes.MapRoute(             name : "areas",             template : "{area:exists}/{controller=Home}/{action=Index}/{id?}"           );         });

中的template area的值似乎只能是exists,改成区域名或其他值都会报错。。。

暂时还不清楚为什么,记录一下

 


最新回复(0)