title: No service while customize a new User Context Identity
body: <p>I'm stuck trying to create a User and a new context to add fields to the AspNetUsers table.</p>
  
  <p>I am surprised that the error indicates that there is no service for the context I created when I think I changed the code correctly.</p>
  
  <p>I have currently completed the following steps:</p>
  
  <ol>
  <li><p>Add all Razor Identity pages by creating a new context 'jakformulaireContext'.</p></li>
  <li><p>In jakformularUser, I added all the fields I need.</p></li>
  <li><p>I deleted the existing db (which had been generated automatically with ApplicationDbContext).</p></li>
  <li><p>I did the migration of jakformulaireContext.</p></li>
  <li><p>I made an Update Database and the fields were created in my new DB.</p></li>
  <li><p>I also modified the startup.cs file, here is the modified piece of code:</p>
  
  <pre><code>services.AddDbContext&lt;jakformulaireContext&gt;(options =&gt;
      options.UseSqlServer(
          Configuration.GetConnectionString("jakformulaireContextConnection")));
  services.AddDefaultIdentity&lt;jakformulaireUser&gt;()
      .AddEntityFrameworkStores&lt;jakformulaireContext&gt;();
  </code></pre></li>
  </ol>
  
  <p>I followed a Microsoft tutorial for this but when I start the site the error is this:</p>
  
  <pre><code>An unhandled exception occurred while processing the request.
  InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager`1[jak.formulaire.Models.jakformulaireContext]' has been registered.
  Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
  
  Stack Query Cookies Headers
  </code></pre>
  
  <p><strong>Stack</strong></p>
  
  <pre><code>nvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager`1[jak.formulaire.Models.jakformulaireContext]' has been registered.
  Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
  Microsoft.AspNetCore.Mvc.Razor.Internal.RazorPagePropertyActivator+&lt;&gt;c__DisplayClass8_0.&lt;CreateActivateInfo&gt;b__1(ViewContext context)
  Microsoft.Extensions.Internal.PropertyActivator&lt;TContext&gt;.Activate(object instance, TContext context)
  Microsoft.AspNetCore.Mvc.Razor.Internal.RazorPagePropertyActivator.Activate(object page, ViewContext context)
  Microsoft.AspNetCore.Mvc.Razor.RazorPageActivator.Activate(IRazorPage page, ViewContext context)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
  Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.RenderPartialViewAsync(TextWriter writer, object model)
  Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
  Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext)
  AspNetCore.Views_Shared__Layout.&lt;ExecuteAsync&gt;b__39_1() in _Layout.cshtml
  +
                                      }
  Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
  AspNetCore.Views_Shared__Layout.ExecuteAsync()
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
  Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
  Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable&lt;int&gt; statusCode)
  Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable&lt;int&gt; statusCode)
  Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
  Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync&lt;TFilter, TFilterAsync&gt;()
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext&lt;TFilter, TFilterAsync&gt;(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
  Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
  Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
  Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
  Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
  Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
  Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  </code></pre>