找不到投掷视图,但确实有

问题描述 投票:0回答:1
InvalidOperationException: The view 'Register' was not found. The following locations were searched:
/Views/Account/Register.cshtml
/Views/Shared/Register.cshtml

出现此错误。

在我的帐户管理员中,我有:

public class AccountController : Controller
    {
        [HttpGet]
        public IActionResult Register()
        {
            return View();
        }
        [HttpGet]
        public IActionResult Login()
        {
            return View();
        }
    }

该视图显然存在:

enter image description here

我已经尝试在Account(应该在其中。)中,只是在共享中尝试了这两种方法,如下所示。每次相同的错误。 Login可以正常工作。我尝试了一个干净的版本,并得到相同的问题。

asp.net .net-core asp.net-core-identity
1个回答
0
投票

在您创建的项目上设置routes.MapRoute

© www.soinside.com 2019 - 2024. All rights reserved.