https://localhost:7082/EmpList/EmployeeData/Index
当请求通过“return View()”时,它无法识别视图页面,我希望显示“localhost:7082”,然后直接显示索引页面。但我不工作
我看过你的图片,发现你已经用 EmpList 硬编码了端点。相反,你应该执行以下操作
endpoints.MapControllerRoute("area", "{area:exists}/{controller=Home}/{action=Index}/{id?}");
然后在控制器中,您需要指定如下区域。这种单一配置适用于多个区域
[Area("Products")]
public class ProductController: Controller
{
}
[Area("EmpList")]
public class EmployeeDataController: Controller
{
}