title: System.ArgumentNullException: Value cannot be null, Parameter name: implementationInstance
body: <p>I deployed .NET core mvc application in IIS, when I run app, the page show 502.5 error, I run command in powershell "dotnet D:\deploy\WebApp\WebApp.dll" ,this follow show detail error content: </p>
  
  <p><strong>NOTE:</strong>.net core version 2.0.0 </p>
  
  <pre>
  Unhandled Exception: System.ArgumentNullException: Value cannot be null.
  
  Parameter name: implementationInstance
  
  at Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions
  .AddSingleton[TService](IServiceCollection services, TService implementationInstance)
  </pre>
  
  <p>I know how the error occurred, how to instantiate?</p>
  
  <pre><code>public class Startup
  {   ...
      public void ConfigureServices(IServiceCollection services)
      {
          ...
          services.AddSingleton(CreateQuery());  // this is error location
          ...
      }
  
      IQuery CreateQuery()
      {
          IQuery query = null;
          var dataBase = Configuration.GetSection("AppSettings")["DataBase"];
          var defaultConnection = Configuration.GetSection("ConnectionStrings")["SqlServer"];
          switch (dataBase)
          {
              case "sqlserver":
                  query = new WebApp.Query.Query(defaultConnection);
                  break;
          }
          return query;
      }
  }
  </code></pre>