title: ASP.NET Core Dependency Injection error: Unable to resolve service for "Identity User" type while attempting to activate "Identity User"
body: <p>The Errormessage is this:</p>
  
  <p>The path /account/register threw an exception System.InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.IUserStore<code>1[Microsoft.AspNetCore.Identity.IdentityUser]' while attempting to activate 'Microsoft.AspNetCore.Identity.UserManager</code>1[Microsoft.AspNetCore.Identity.</p>
  
  <p>I can't figure out what causes this. Any help is greatly appreciated, thank you!</p>
  
  <pre><code>    public class AccountController : Controller
      {
          private readonly UserManager&lt;IdentityUser&gt; userManager;
          private readonly SignInManager&lt;IdentityUser&gt; signInManager;
  
          public AccountController(UserManager&lt;IdentityUser&gt; userManager,
                                   SignInManager&lt;IdentityUser&gt; signInManager)
          {
              this.userManager = userManager;
              this.signInManager = signInManager;
          }
  
         [HttpGet]
          public IActionResult Register()
          {
  
              return View();
          }
  
          [HttpPost]
          public async Task&lt;IActionResult&gt; Register(RegisterViewModel model)
          {
              if(ModelState.IsValid)
              {
                  var user = new IdentityUser { UserName = model.Email, Email = model.Email };
                  var result = await userManager.CreateAsync(user, model.Password);
  
                  if(result.Succeeded)
                  {
                      // Persistend creates either session or permanent cookie
                      await signInManager.SignInAsync(user, isPersistent: false);
                      return RedirectToAction("index", "home");
                  }
  
                  foreach (var error in result.Errors)
                  {
                      // Adding this to Modelstate goes to validation-summary in register.cshtml
                      ModelState.AddModelError("", error.Description);
                  }
              }
              return View(model);
          }
      }
  
  </code></pre>