title: ASP.Net Core 2 Unable to resolve service for type
body: <p>I'm attempting to register my own custom options. I have, in my ASP.Net project (Kimble.API), an <code>appsettings.json</code> file. It looks like this:</p>
  
  <pre><code>{
      "NotificationHub": {
          "AccountName": "my-notification-hub-name",
          "ConnectionString": "my-secret-connection-string"
      }
  }
  </code></pre>
  
  <p>In my .Net Standard library (Kimble.Core), which the API project references, I have a class <code>NotificationHubOptions</code>:</p>
  
  <pre><code>public class NotificationHubOptions
  {
      public string AccountName { get; set; }
      public string ConnectionString { get; set; }
  }
  </code></pre>
  
  <p>Back to the API project. </p>
  
  <p>In my <code>Startup.cs</code> file, in the <code>ConfigureServices</code> method, I register the options:</p>
  
  <pre><code>services.Configure&lt;NotificationHubOptions&gt;(configuration.GetSection("NotificationHub"));
  </code></pre>
  
  <p>I've checked, and the registration does show up in the <code>services</code> collection. </p>
  
  <p>My controller's constructor looks like this:</p>
  
  <pre><code>public MyController(NotificationHubOptions options)
  {
      _notificationHubOptions = options;
  }
  </code></pre>
  
  <p>However, when I try to call a method on the controller, I always get an exception:</p>
  
  <blockquote>
    <p><strong>System.InvalidOperationException:</strong> 'Unable to resolve service for type 'Kimble.Core.Options.NotificationHubOptions' while attempting to activate 'Kimble.API.Controllers.MyController'.'</p>
  </blockquote>
  
  <p>This all worked before I moved the <code>NotificationHubOptions</code> class to my Core project. However, I can't see why that should matter at all.</p>