title: Unable to resolve service for type 'Microsoft.AspNetCore.Cors.Infrastructure.ICorsService
body: <p>I observe an exception executing the following code:</p>
  
  <pre><code>[&lt;EntryPoint&gt;]
  let main argv =                         
      WebHostBuilder()
          .UseKestrel()
          .UseContentRoot(Directory.GetCurrentDirectory())
          .UseIISIntegration()
          .Configure(Action&lt;IApplicationBuilder&gt; configureApp)
          .ConfigureServices(Action&lt;IServiceCollection&gt; configureServices)
          .Build()
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Unable to resolve service for type
    'Microsoft.AspNetCore.Cors.Infrastructure.ICorsService</p>
  </blockquote>
  
  <p>Details:</p>
  
  <blockquote>
    <p>System.InvalidOperationException: 'Unable to resolve service for type
    'Microsoft.AspNetCore.Cors.Infrastructure.ICorsService' while
    attempting to activate
    'Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware'.'</p>
  </blockquote>
  
  <p>I added the Cors code here:</p>
  
  <pre><code>let configureServices (services : IServiceCollection) =
      ...
      services.AddAuthentication() |&gt; ignore
      services.AddCors |&gt; ignore // Enables CORS
  </code></pre>
  
  <p>Note:</p>
  
  <p>This all use to work until I added ASP.Net WebAPI support for some json that I was struggling with.</p>
  
  <p>In addition, I also upgraded my Nuget packages to 2.0.</p>
  
  <p>The source code can be found on <a href="https://github.com/bizmonger/Nikeza/blob/master/Server/Nikeza.Server/Program.fs" rel="noreferrer">GitHub</a>.</p>