Good night. The main goal is the possibility of full-fledged ASP.Identity core operation in a project under ASP.NET CORE + WEB API. I wanted to make a migration before the possibility of using the built-in user storage model in Identity, but I got an error object reference.

More details:

enter image description here

enter image description here

Startup.cs:

public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddEntityFrameworkSqlServer(); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.RequireHttpsMetadata = false; options.TokenValidationParameters = new TokenValidationParameters { // укзывает, будет ли валидироваться издатель при валидации токена ValidateIssuer = true, // строка, представляющая издателя ValidIssuer = AuthOptions.ISSUER, // будет ли валидироваться потребитель токена ValidateAudience = true, // установка потребителя токена ValidAudience = AuthOptions.AUDIENCE, // будет ли валидироваться время существования ValidateLifetime = true, // установка ключа безопасности IssuerSigningKey = AuthOptions.GetSymmetricSecurityKey(), // валидация ключа безопасности ValidateIssuerSigningKey = true, }; }); services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDefaultFiles(); app.UseStaticFiles(); app.UseAuthentication(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); } } 
  • one
    En SO . In a nutshell, "Make sure that there is a .config file in the project folder" or "try selecting the default project" - EvgeniyZ
  • one
    If you are writing an ASP.NET CORE project, then you need to use the Entity Framework CORE , and not like your Entity Framework 6.2.0 - Bulson
  • @Bulson thanks. The removal of the Entity Framework 6.2.0 helped. Before that, I had the Entity Framework CORE installed, I can see the environment, I saw EF 6.2.0, or there was some conflict between them - Andrew_Romanuk
  • @EvgeniyZ Thanks for the reply ~ - Andrew_Romanuk

0