title: Some services are not able to be constructed (Error while validating the service descriptor) C#
body: <p>I am making asp .NET core web API and I made some services and I injected it and it is working fine.
  I made a new web app in the same solution and I want to use the same services
  and I just got</p>
  <blockquote>
  <p>Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable serviceDescriptors, IServiceProviderEngine engine, ServiceProviderOptions options)</p>
  </blockquote>
  <blockquote>
  <p>AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: E_CommerceApi.Services.IAttributeService Lifetime: Scoped ImplementationType: E_CommerceApi.Services.AttributeService': Unable to resolve service for type 'E_CommerceApi.Authentication.ApplicationDbContext' while attempting to activate 'E_CommerceApi.Services.AttributeService'.)</p>
  </blockquote>
  <p>Service and IService Code</p>
  <pre><code> public interface IAttributeService
   {
     Task&lt;AllAttributes&gt; GetAll();
   }
  
  
   public class AttributeService : IAttributeService
   {
     private readonly ApplicationDbContext _db;
     public AttributeService(ApplicationDbContext db)
     {
         _db = db;
     }
   }
  </code></pre>
  <p>Injecting the service in the same project</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddControllers();
      services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;ConnStr&quot;)));
      // register services
      services.AddScoped&lt;IAttributeService, AttributeService&gt;();
  }
  </code></pre>
  <p>Injecting service in another web project which is not working</p>
  <pre><code>  public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllersWithViews();
        services.AddScoped&lt;IAttributeService, AttributeService&gt;();
    }
  </code></pre>