title: InvalidOperationException: Unable to resolve service for type while attempting to activate controller
body: <p>I'm working on updating the options for a project. Nothing in the code changes, we just create a new options class and update the information. While testing I cam across this error:</p>
  <blockquote>
  <p>InvalidOperationException: Unable to resolve service for type
  'Genetics.Meeting.Abstracts.Services.AbstractsService' while
  attempting  to activate 'Genetics.Meeting.Abstracts.Controllers.Abstract'.</p>
  </blockquote>
  <p>This is a controller in another project that this project references. I haven't made any code changes there.</p>
  <pre><code>    private AbstractsService _service;
      
      public Abstract(AbstractsService service)
      {
          _service = service;
      }
  </code></pre>
  <p>That is the code referencing the service in the controller.</p>
  <pre><code>    services.AddScoped&lt;AbstractsService&gt;();
  </code></pre>
  <p>This is the reference in the Startup.cs for that project.</p>
  <p>In the project where I'm receiving the error the ConfigureServices:</p>
  <pre><code>    public void ConfigureServices(IServiceCollection services)
      {
          DbHelper.ConnectionString = Configuration.GetConnectionString(&quot;MeetingDataBase&quot;);
          services.AddAbstractOptions(Configuration);
          services.AddOptions();
          services.Configure&lt;Genetics.Lib.Common.GeneticsCommonOption&gt;(Configuration);
          services.Configure&lt;Genetics.Meeting.Abstracts.Options.RuntimeOption&gt;(Configuration.GetSection(&quot;RuntimeOption&quot;));
          services.AddGeneticsLists();
  
          //Areas
          Genetics.Meeting.Areas.AbstractReport.AbstractReportStartup.ConfigureServices(services);
          Genetics.Meeting.Areas.Program.ProgramStartup.ConfigureServices(services);
  
          services.AddScoped&lt;Modules.ErrorReporter&gt;();
          services.AddScoped&lt;Filters.ErrorReporterSetupFilter&gt;();
  
          // Add framework services.
          services.AddMvc(option =&gt;
          {
              option.Filters.Add(typeof(Filters.ErrorReporterSetupFilter));
          })
          .AddViewOptions(option =&gt;
          {
              option.HtmlHelperOptions.ClientValidationEnabled = false;
          });
          services.AddApplicationInsightsTelemetry(Configuration);
      }
  </code></pre>
  <p>If I comment out all the code using the AbstractsService on the Abstract controller I then get this error.</p>
  <pre><code>    InvalidOperationException: The view 'Index' was not found. The 
      following locations were searched:
      /Views/Abstract/Index.cshtml
      /Views/Shared/Index.cshtml
  </code></pre>
  <p>The view is located in the Abstract folder</p>