我有一个带有Identity的asp.net核心Razor页面项目。在页面中,未生成“登录”链接。我有以下内容:
LoginPartial:
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a asp-page="/Account/Login" class="nav-link">Login</a></li>
</ul>
Startup.cs:
services.AddIdentity<ApplicationUser, ApplicationRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();
和
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseMvc();
无论如何,我的HTML变成这样,HREF为空:
<li class="nav-item"><a class="nav-link" href="">Login</a></li>
此外,如果我直接在浏览器中输入链接,例如https://localhost:44305/Account/Login
,则会得到This localhost page can’t be found