title: .NET Core Web API An exception was thrown while activating
body: <p>I'm getting the following exception when sending a post request to my web api: </p>
  
  <blockquote>
    <p>Autofac.Core.DependencyResolutionException: An exception was thrown
    while activating WAM4.WebAPI.Core.UseCases.RegisterUserUseCase ->
    WAM4.WebAPI.Infrastructure.Data.Repositories.UserRepository ->
    Microsoft.AspNetCore.Identity.UserManager<code>1[[WAM4.WebAPI.Infrastructure.Identity.AppUser,
    WAM4.WebAPI.Infrastructure, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=null]]. ---&gt;
    Autofac.Core.DependencyResolutionException: None of the constructors
    found with
    'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type
    'Microsoft.AspNetCore.Identity.UserManager</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser]'
    can be invoked with the available services and parameters:
        Cannot resolve parameter 'Microsoft.AspNetCore.Identity.IUserStore<code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser]
    store' of constructor 'Void
    .ctor(Microsoft.AspNetCore.Identity.IUserStore</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser],
    Microsoft.Extensions.Options.IOptions<code>1[Microsoft.AspNetCore.Identity.IdentityOptions],
    Microsoft.AspNetCore.Identity.IPasswordHasher</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser],
    System.Collections.Generic.IEnumerable<code>1[Microsoft.AspNetCore.Identity.IUserValidator</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser]],
    System.Collections.Generic.IEnumerable<code>1[Microsoft.AspNetCore.Identity.IPasswordValidator</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser]],
    Microsoft.AspNetCore.Identity.ILookupNormalizer,
    Microsoft.AspNetCore.Identity.IdentityErrorDescriber,
    System.IServiceProvider,
    Microsoft.Extensions.Logging.ILogger<code>1[Microsoft.AspNetCore.Identity.UserManager</code>1[WAM4.WebAPI.Infrastructure.Identity.AppUser]])'.</p>
  </blockquote>
  
  <p>These are my 2 modules that get "build()" into the container and the AppUser class: </p>
  
  <pre><code>    public class InfrastructureModule : Module
          {
              protected override void Load(ContainerBuilder builder)
              {
                  builder.RegisterType&lt;UserRepository&gt;().As&lt;IUserRepository&gt;().InstancePerLifetimeScope();
                  builder.RegisterType&lt;JwtFactory&gt;().As&lt;IJwtFactory&gt;().SingleInstance().FindConstructorsWith(new InternalConstructorFinder());
                  builder.RegisterType&lt;JwtTokenHandler&gt;().As&lt;IJwtTokenHandler&gt;().SingleInstance().FindConstructorsWith(new InternalConstructorFinder());
                  builder.RegisterType&lt;TokenFactory&gt;().As&lt;ITokenFactory&gt;().SingleInstance();
                  builder.RegisterType&lt;JwtTokenValidator&gt;().As&lt;IJwtTokenValidator&gt;().SingleInstance().FindConstructorsWith(new InternalConstructorFinder());
                  builder.RegisterType&lt;Logger&gt;().As&lt;ILogger&gt;().SingleInstance();
              }
          }
  
  
  public class CoreModule : Module
      {
          protected override void Load(ContainerBuilder builder)
          {
              builder.RegisterType&lt;RegisterUserUseCase&gt;().As&lt;IRegisterUserUseCase&gt;().InstancePerLifetimeScope();
              builder.RegisterType&lt;LoginUseCase&gt;().As&lt;ILoginUseCase&gt;().InstancePerLifetimeScope();
              builder.RegisterType&lt;ExchangeRefreshTokenUseCase&gt;().As&lt;IExchangeRefreshTokenUseCase&gt;().InstancePerLifetimeScope();
          }
      }
  
  using Microsoft.AspNetCore.Identity;
  //using System;
  //using System.ComponentModel.DataAnnotations;
  
  namespace WAM4.WebAPI.Infrastructure.Identity
  {
      public class AppUser : IdentityUser
      {
          //Add additional profile data for application users by adding properties to this class
          //[Required]
          //[MaxLength(100)]
          //public string FirstName { get; set; }
  
          //[Required]
          //[MaxLength(100)]
          //public string LastName { get; set; }
  
          ////[Required]
          ////public byte SecurityLevel { get; set; }
  
          //[Required]
          //public DateTime CreateDate { get; set; }
  
          //public int Pending { get; set; }
  
          //public string Avatar { get; set; }
      }
  }
  </code></pre>
  
  <p>I've checked to see that UserRepository is properly registered in Load, and that AppUser class is properly compiled. Any guidance on what area I should be looking into to resolve this exception, would be greatly appreciated. </p>