ASP. Net MVC asyn c Метод индекса не отображает страницу индекса, если я явно не добавляю индекс в URL - PullRequest
0 голосов
/ 02 марта 2020

Это мой метод Index внутри контроллера с именем «Media».

public class MediaController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Media
        public async Task<ActionResult> Index()
        {
            var media = db.Media.Include(m => m.Artist).Include(m => m.MediaCategory).Include(m => m.MediaType);
            return View(await media.ToListAsync());
        }
    }

И вот как я его называю внутри пункта меню

 @Html.ActionLink("Media", "Index", "Media", null, new { @class = "dropdown-item"})

Но когда я захожу » https://localhost: 44398 / Media /", отображается сообщение об ошибке 403, он не посещает страницу индекса автоматически.

Ошибка HTTP 403.14 - Запрещен Веб-сервер настроен не перечислять содержимое этого каталога. Наиболее вероятные причины:

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Вещи, которые вы можете попробовать:

If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing.
    Go to the IIS Express install directory.
    Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
    Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Папка просмотра мультимедиа Strucutre

В моем компьютере настроена маршрутизация по умолчанию сайт.

...