The original framework has a area, and then I added a new area, F5 debugging, can normal visit, but release the dog the original area can access, I can't access to the new area, could you tell me how to solve?
Controller has been increased by adding AreaAttribute attribute
MapRoute is written so
App. UseRouting (); App. UseEndpoints (endpoints=& gt; { Endpoints. MapControllerRoute (" areas ", "{area: the exists}/{controller=Home}/{action=Index}/{id? } "); Endpoints. MapControllerRoute (" default ", "{controller=Home}/{action=Index}/{id? } "); }); CodePudding user response:
CodePudding user response:
Oneself the top
CodePudding user response:
CodePudding user response:
Used core,
I think,
1 May be a routing problem,
2 is released, whether CustomersLibraryIndex. CSHTML?
Are you in lunix or released Windows?
CodePudding user response:
Area to routing to rewrite the
[Area (" Admin ")]
[the Route ("/Admin/Product/List ")]
CodePudding user response:
[Area (" Admin ")] [the Route (" Admin/[controller]/[action] ")] [the Authorize (AuthenticationSchemes=AdminAuthorizeAttribute. AuthenticationScheme)] Public class AdminController: Controller { IWebHostEnvironment _hostingEnvironment; IAdminService _adminService; IRoleService _roleService; Public AdminController (IWebHostEnvironment webHostEnvironment, IAdminService adminService, IRoleService roleService) { _roleService=roleService; _hostingEnvironment=webHostEnvironment; _adminService=adminService; } } CodePudding user response:
Routing see. Area, the best way is to go to the MSDN..net MVC CORE, the routing rules, make sure would like to change a word. In addition to estimate use framework is to make clear rules
CodePudding user response:
refer to 7th floor mirror030 response: routing. Area, the best way is to go to the MSDN..net MVC CORE, the routing rules, make clear in addition to estimate just change a word. Use the framework is to make clear rules refer to 6th floor programming rich reply: [Area (" Admin ")] [the Route (" Admin/[controller]/[action] ")] [the Authorize (AuthenticationSchemes=AdminAuthorizeAttribute. AuthenticationScheme)] Public class AdminController: Controller { IWebHostEnvironment _hostingEnvironment; IAdminService _adminService; IRoleService _roleService; Public AdminController (IWebHostEnvironment webHostEnvironment, IAdminService adminService, IRoleService roleService) { _roleService=roleService; _hostingEnvironment=webHostEnvironment; _adminService=adminService; } } refer to 4th floor are nu month god reply: used core, I think, 1 May be a routing problem, 2 is released, whether CustomersLibraryIndex. CSHTML? Are you in lunix or released Windows? Is not a problem you said, should be released out of the question, when I limit bin file is generated by CTRL + f5, and then the bin file copy to release directory, you can find the view file, access to normal, CodePudding user response:
refer to the eighth floor ayun00 response: Quote: refer to 7th floor mirror030 response: Routing see. Area, the best way is to go to the MSDN..net MVC CORE, the routing rules, make clear in addition to estimate just change a word. Use the framework is to make clear rules refer to 6th floor programming rich reply: [Area (" Admin ")] [the Route (" Admin/[controller]/[action] ")] [the Authorize (AuthenticationSchemes=AdminAuthorizeAttribute. AuthenticationScheme)] Public class AdminController: Controller { IWebHostEnvironment _hostingEnvironment; IAdminService _adminService; IRoleService _roleService; Public AdminController (IWebHostEnvironment webHostEnvironment, IAdminService adminService, IRoleService roleService) { _roleService=roleService; _hostingEnvironment=webHostEnvironment; _adminService=adminService; } } refer to 4th floor are nu month god reply: used core, I think, 1 May be a routing problem, 2 is released, whether CustomersLibraryIndex. CSHTML? Are you in lunix or released Windows? Is not a problem you said, should be released out of the question, when I limit bin file is generated by CTRL + f5, and then the bin file copy to release directory, you can find the view file, access to normal, A little bit strange situation, It makes me feel, if you produce, whether there is an error? CodePudding user response:
references are anger, 9/f, in god's response: Quote: refer to the eighth floor ayun00 response: Quote: refer to 7th floor mirror030 response: Routing see. Area, the best way is to go to the MSDN..net MVC CORE, the routing rules, make clear in addition to estimate just change a word. Use the framework is to make clear rules refer to 6th floor programming rich reply: [Area (" Admin ")] nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull