title: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager` while attempting to activate 'xxxxx.LoginModel'
body: <p>I have scaffolded the Identity using the CLI as</p>
  <pre><code>dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
  dotnet add package Microsoft.EntityFrameworkCore.Design
  </code></pre>
  <p>Then I list all the files</p>
  <pre><code>dotnet aspnet-codegenerator identity --listFiles
  </code></pre>
  <p>I used the login <code>dotnet aspnet-codegenerator identity --files=&quot;Account.Login&quot;</code>
  Now I can see in the Area section the login.cshtml file is generated</p>
  <p><a href="https://i.stack.imgur.com/mE94n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mE94n.png" alt="enter image description here" /></a></p>
  <p>Now when I navigate to <code>https://localhost:5001/Identity/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DVotingApplication%26redirect_uri%3Dhttps%253A%252F%252Flocalhost%253A5001%252Fauthentication%252Flogin-callback%26response_type%3Dcode%26scope%3DVotingApplicationAPI%2520openid%2520profile%26state%3Daceb10c45488493b9a675c830327ecbf%26code_challenge%3DnU-0BBK2wjgOSEDdB4Qjy5T8f3qHWTlgu0UmMgVDEAU%26code_challenge_method%3DS256%26response_mode%3Dquery</code></p>
  <p>I get an exception as</p>
  <pre><code>InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager`1[Microsoft.AspNetCore.Identity.IdentityUser]' while attempting to activate 'VotingApplication.Areas.Identity.Pages.Account.LoginModel'.
  </code></pre>
  <p>In the startup.cs I have the below configuration</p>
  <pre><code>services.AddIdentityServer()
                  .AddApiAuthorization&lt;ApplicationUser, ApplicationDbContext&gt;()
                  .AddProfileService&lt;ProfileService&gt;();
  </code></pre>
  <p>Since I am using the <code>ApplicationUser</code>, I am not able to see the account controller when I do the scaffolder.</p>
  <pre><code>public class IdentityHostingStartup : IHostingStartup
  {
      public void Configure(IWebHostBuilder builder)
      {
          builder.ConfigureServices((context, services) =&gt; {
              services.AddDefaultIdentity&lt;ApplicationUser&gt;(options =&gt; options.SignIn.RequireConfirmedAccount = true)
                  .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;();
          });
      }
  }
  </code></pre>
  <p>Since the scaffolder is using <code>IdentityUser</code>, how can I make this to work with <code>ApplicationUser</code></p>
  <p><strong>_LoginPartial.cshtml</strong></p>
  <pre><code>@using Microsoft.AspNetCore.Identity
  @using global::Data
  @using global::Data.Domain
  @inject SignInManager&lt;ApplicationUser&gt; SignInManager
  @inject UserManager&lt;ApplicationUser&gt; UserManager
  
  @{
      string returnUrl = null;
      var query = ViewContext.HttpContext.Request.Query;
      if (query.ContainsKey(&quot;returnUrl&quot;))
      {
          returnUrl = query[&quot;returnUrl&quot;];
      }
  }
  
  &lt;ul class=&quot;navbar-nav&quot;&gt;
      @if (SignInManager.IsSignedIn(User))
      {
          &lt;li class=&quot;nav-item&quot;&gt;
              &lt;a class=&quot;nav-link text-dark&quot; asp-area=&quot;Identity&quot; asp-page=&quot;/Account/Manage/Index&quot; title=&quot;Manage&quot;&gt;Hello @User.Identity.Name!&lt;/a&gt;
          &lt;/li&gt;
          &lt;li class=&quot;nav-item&quot;&gt;
              &lt;form class=&quot;form-inline&quot; asp-area=&quot;Identity&quot; asp-page=&quot;/Account/Logout&quot; asp-route-returnUrl=&quot;/&quot;&gt;
                  &lt;button type=&quot;submit&quot; class=&quot;nav-link btn btn-link text-dark&quot;&gt;Logout&lt;/button&gt;
              &lt;/form&gt;
          &lt;/li&gt;
      }
      else
      {
          &lt;li class=&quot;nav-item&quot;&gt;
              &lt;a class=&quot;nav-link text-dark&quot; asp-area=&quot;Identity&quot; asp-page=&quot;/Account/Register&quot; asp-route-returnUrl=&quot;@returnUrl&quot;&gt;Register&lt;/a&gt;
          &lt;/li&gt;
          &lt;li class=&quot;nav-item&quot;&gt;
              &lt;a class=&quot;nav-link text-dark&quot; asp-area=&quot;Identity&quot; asp-page=&quot;/Account/Login&quot; asp-route-returnUrl=&quot;@returnUrl&quot;&gt;Login&lt;/a&gt;
          &lt;/li&gt;
      }
  &lt;/ul&gt;
  </code></pre>