title: Asp.Net Core 2.0.5 deployment on IIS
body: <p>I try to deploy my asp.net Core 2.0.5 project to IIS. 
  I created a default Asp.Net Core MVC application and I deployed it. Every thing worked correctly.
  But when I added in program.cs:</p>
  
  <pre><code>using (var scope = host.Services.CreateScope())
  {
      var initializer = scope.ServiceProvider.GetService&lt;MasterDbInitializer&gt;();
      initializer.Seed();
  }
  </code></pre>
  
  <p>and in startup.cs:</p>
  
  <pre><code>        services.AddScoped&lt;MasterDbInitializer&gt;();
  </code></pre>
  
  <p>and MasterDbInitializer.cs:</p>
  
  <pre><code>public class MasterDbInitializer
  {
      private readonly MasterDbContext _ctx;
  
      public MasterDbInitializer(MasterDbContext ctx)
      {
          _ctx = ctx;
      }
  
      public void Seed()
      {
          // Run Migrations
          _ctx.Database.Migrate();
  
      }
  }
  </code></pre>
  
  <p>I have : <strong>HTTP Error 502.5 - Process Failure</strong> and the Database is not generated.</p>
  
  <p>So to have more information, in <em>web.config</em> I updated <em>stdoutLogEnabled</em> to <em>true</em> and I added in <em>startup.cs</em>             <em>loggerFactory.AddFile("Logs/myapp-{Date}.txt");</em> (Serilog) to have more log.</p>
  
  <p>This is what I have in the log:</p>
  
  <blockquote>
    <p>info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
          User profile not available. Using > 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\AutoGenKeys\XXXX\DataProtection' as key repository and Windows DPAPI to encrypt keys at rest.
    warn: Microsoft.EntityFrameworkCore.Model.Validation[20601]
          The 'bool' property 'HasBeenReroutedToCustomer' on entity type > 'ActivationRequest' is configured with a database-generated default. This > > default will always be used when the property has the value 'false', since this is the CLR default for the 'bool' type. Consider using the nullable 'bool?' type instead so that the default will only be used when the property value is 'null'.
    warn: Microsoft.EntityFrameworkCore.Model.Validation[20601]
          The 'bool' property 'HasBeenViewed' on entity type 'ActivationRequest' is configured with a database-generated default. This default will always be used when the property has the value 'false', since this is the CLR default for the 'bool' type. Consider using the nullable 'bool?' type instead so that the > default will only be used when the property value is 'null'.
    warn: Microsoft.EntityFrameworkCore.Model.Validation[20601]
          The 'bool' property 'Deleted' on entity type 'MasterDeviceIdentifier' is configured with a database-generated default. This default will always be used when the property has the value 'false', since this is the CLR default for the 'bool' type. Consider using the nullable 'bool?' type instead so that the default will only be used when the property value is 'null'.
    info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
          Entity Framework Core 2.0.1-rtm-125 initialized 'MasterDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None</p>
  </blockquote>