Открытие страницы просмотра с пользовательским маршрутом на asp. net core - PullRequest
0 голосов
/ 13 марта 2020

У меня проблема с открытием страницы просмотра на моем пользовательском маршруте, который я использую Asp. Net Core 3.1

BrandController

[Area("CormComm")]
    [Route("CorpComm/[controller]/[Action]")]
    public class BrandController : Controller
    {
        private readonly CorpCommDbContext _context;

        public BrandController(CorpCommDbContext context)
        {
            _context = context;
        }

Вот моя файловая структура. Я добавил папку с именем CorpComm в папку View и перетащил папку Brand в CorpComm. Затем я запускаю страницу и с go до https://localhost:44325/CorpComm/Brand/index она говорит

InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Areas/CormComm/Views/Brand/Index.cshtml
/Areas/CormComm/Views/Shared/Index.cshtml
/Views/Shared/Index.cshtml
/Pages/Shared/Index.cshtml

View Структура страницы:

enter image description here

Структура контроллера:

enter image description here

Привет, Это Мои конфиги маршрутизации

app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");

                endpoints.MapControllerRoute(
                    name: "corpcomm",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
            });
...