title: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager` while attempting to activate 'AuthController'
body: <p>I'm getting this error in Login Controller.</p>
  
  <blockquote>
    <p>InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[Automobile.Models.Account]' while attempting to activate 'Automobile.Server.Controllers.AuthController'.</p>
  </blockquote>
  
  <p>here is Auth Controller constructor:</p>
  
  <pre><code>private SignInManager&lt;Automobile.Models.Account&gt; _signManager;
      private UserManager&lt;Automobile.Models.Account&gt; _userManager;
  
      public AuthController(UserManager&lt;Models.Account&gt; userManager,
                            SignInManager&lt;Automobile.Models.Account&gt; signManager)
      {
          this._userManager = userManager;
          this._signManager = signManager;
      }
  </code></pre>
  
  <p>and here is ConfigureServices in startup.cs:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
      {
          // Add framework services.
          services.AddApplicationInsightsTelemetry(Configuration);
          services.Configure&lt;AppConfig&gt;(Configuration.GetSection("AppSettings"));
  
          //var provider = HttpContext.ApplicationServices;
          //var someService = provider.GetService(typeof(ISomeService));
  
  
          services.AddDbContext&lt;Providers.Database.EFProvider.DataContext&gt;(options =&gt; options
              .UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
                   b =&gt; b.MigrationsAssembly("Automobile.Server")
              ));
  
  
          services.AddIdentity&lt;IdentityUser, IdentityRole&gt;(options =&gt;
          {
              options.User.RequireUniqueEmail = false;
          })
          .AddEntityFrameworkStores&lt;Providers.Database.EFProvider.DataContext&gt;()
          .AddDefaultTokenProviders(); 
          //services.AddScoped&lt;SignInManager&lt;Automobile.Models.Account&gt;, SignInManager&lt;Automobile.Models.Account&gt;&gt;();
          //services.AddScoped&lt;UserManager&lt;Automobile.Models.Account&gt;, UserManager&lt;Automobile.Models.Account&gt;&gt;();
  
          services.AddMvc();
          App.Service = services.BuildServiceProvider();
  
          // Adds a default in-memory implementation of IDistributedCache.
          services.AddDistributedMemoryCache();
  
          services.AddSession(options =&gt;
          {
              // Set a short timeout for easy testing.
              options.IdleTimeout = TimeSpan.FromSeconds(10);
              options.CookieHttpOnly = true;
          });
  
      }
  </code></pre>