简单的翻译下,这个错误是由于请求的url地址匹配到多个路由处理程序所致,我的完整错误如下:
An unhandled exception occurred while processing the request.
InvalidOperationException: Multiple handlers matched. The following handlers matched route data and had all constraints satisfied:

Microsoft.AspNetCore.Mvc.IActionResult OnGet(), Void OnGetAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageHandlerMethodSelector.Select(PageContext context)
InvalidOperationException: Multiple handlers matched. The following handlers matched route data and had all constraints satisfied: Microsoft.AspNetCore.Mvc.IActionResult OnGet(), Void OnGetAsync()
如下图:

001

原因我也标在图上了,是说同时有两个方法满足该请求,系统也不知道该使用哪个方法。

IActoinResult OnGet()和 void OnGetAsync() 这两个方法效果是一样的。去掉一个就可以了。