[英]'IApplicationBuilder' does not contain a definition for 'MapAzureSignalR'
[英]IApplicationBuilder does not contain a definition for UseIdentity
我正在按照一个示例在AspNet Core 3.0上配置 AspNet Core Identity
这是 StartUp.cs 文件的代码
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Users_WEB_APP.Models;
namespace Users_WEB_APP
{
public class Startup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AppIdentityDbContext>(options => options.UseSqlServer(Configuration["Data:ASPNET_IDENTITY:ConnectionString"]));
services.AddIdentity<AppUser, IdentityRole>()
.AddEntityFrameworkStores<AppIdentityDbContext>();
services.AddMvc(options => options.EnableEndpointRouting = false);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStatusCodePages();
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseIdentity();
app.UseMvcWithDefaultRoute();
}
}
}
但是在app.UseIdentity(); 行我收到错误
“IApplicationBuilder”不包含“UseIdentity”的定义,并且找不到接受“IApplicationBuilder”类型的第一个参数的可访问扩展方法“UseIdentity”(您是在搞乱 using 指令还是程序集引用?)
我做错了什么?
文档说从 ASP.NET Core 2.2 开始, UseIdentity
现在已经过时,应该使用UseAuthentication
代替
此方法已过时,将在未来版本中删除。 推荐的替代方法是
UseAuthentication(IApplicationBuilder)
用
app.UseAuthentication();
这个对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.