RouteArea and RoutePrefix cannot be routed

I tried to use the asp.net mvc area function. I encountered the problem of not being able to route after adding the route feature. After trying, I found that the following problems need to be paid attention to:

    1. After adding an area to the project, adding RouteArea to the controller will conflict, and the corresponding area must be removed. (If it is just to add a first-level route to the upper level of the controller, you can remove the area and declare it directly with RouteArea on the controller); the
      last access address as shown in the figure below is: .../api/operation/check
      RouteArea and RoutePrefix cannot be routed

2. To use the route function, you need to add a configuration during route registration, routes.MapMvcAttributeRoutes();
RouteArea and RoutePrefix cannot be routed
3. After the RoutePrefix is ​​declared on the controller, the action under the controller must declare Route, otherwise it cannot be accessed;

Guess you like

Origin blog.51cto.com/volvo9yue/2541636