title: Getting error 500.30 when I try to run my asp.net core 3.1 app on azure
body: <p>I have an app that is asp.net core 3.1 connected to a sql server database and a secrets file.  I can run this all locally, and it works.</p>
  <p>I published my app to Azure, migrated my db there, and created a Key Vault.  All of those say they were successful.</p>
  <p>When I try to publish my app, it says &quot;Configured&quot; for the db and the Key vault, and the app deploys successfully.  However, when it redirects me to the website where my app should be running, I get a 500.30 error.</p>
  <p>These are the errors I was getting yesterday: (I'm not sure what I'm getting now, because I cannot seem to find the page on Azure where I found these, and I've spent about 20 minutes looking for it)</p>
  <p>Error #1</p>
  <pre><code>Application: w3wp.exe
  CoreCLR Version: 4.700.20.26901
  .NET Core Version: 3.1.6
  Description: The process was terminated due to an unhandled exception.
  Exception Info: System.ArgumentNullException: Value cannot be null. (Parameter 'implementationInstance')
     at Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton[TService](IServiceCollection services, TService implementationInstance)
     at RecipeCompendiumTool.Startup.ConfigureServices(IServiceCollection services) in C:\Users\julie\source\repos\RecipeCompendiumTool\Startup.cs:line 44
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.&lt;&gt;c__DisplayClass9_0.&lt;Invoke&gt;g__Startup|0(IServiceCollection serviceCollection)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.&lt;&gt;c__DisplayClass8_0.&lt;Build&gt;b__0(IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.&lt;&gt;c__DisplayClass12_0.&lt;UseStartup&gt;b__0(HostBuilderContext context, IServiceCollection services)
     at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
     at Microsoft.Extensions.Hosting.HostBuilder.Build()
     at RecipeCompendiumTool.Program.Main(String[] args) in C:\Users\julie\source\repos\RecipeCompendiumTool\Program.cs:line 16
  </code></pre>
  <p>Error #2</p>
  <pre><code>Application '/LM/W3SVC/312799001/ROOT' with physical root 'D:\home\site\wwwroot\' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
  Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'implementationInstance')
     at Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton[TService](IServiceCollection services, TService implementationInstance)
     at RecipeCompendiumTool.Startup.ConfigureServices(IServiceCollection services) in C:\Users\julie\source\repos\RecipeCompendiumTool\Startup.cs:line 44
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.&lt;&gt;c__DisplayClass9_0.&lt;Invoke&gt;g__Startup|0(IServiceCollection serviceCollection)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.&lt;&gt;c__DisplayClass8_0.&lt;Build&gt;b__0(IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
     at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.&lt;&gt;c__DisplayClass12_0.&lt;UseStartup&gt;b__0(HostBuilderContext context, IServiceCollection services)
     at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
     at Microsoft.Extensions.Hosting.HostBuilder.Build()
     at RecipeCompendiumTool.Program.Main(String[] args) in C:\Users\julie\source\repos\RecipeCompendiumTool\Program.cs:line 16
  
  Process Id: 6904.
  File Version: 13.1.20169.6. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: 62c098bc170f50feca15916e81cb7f321ffc52ff
  </code></pre>
  <p>Error #3</p>
  <pre><code>Application '/LM/W3SVC/312799001/ROOT' with physical root 'D:\home\site\wwwroot\' failed to load coreclr. Exception message:
  CLR worker thread exited prematurely
  Process Id: 6904.
  File Version: 13.1.20169.6. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: 62c098bc170f50feca15916e81cb7f321ffc52ff
  </code></pre>
  <p>My Startup.cs file</p>
  <pre><code>        public IConfiguration Configuration { get; }
          public IWebHostEnvironment Environment { get; }
  
          public Startup(IConfiguration configuration, IWebHostEnvironment environment)
          {
              Configuration = configuration;
              Environment = environment;
          }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddAuthentication(IISServerDefaults.AuthenticationScheme);
  
              services.AddControllersWithViews();
              services.AddRazorPages();
  
              services.Configure&lt;FormOptions&gt;(x =&gt; x.ValueCountLimit = 1000000000);
  
              services.AddSingleton&lt;IEmailConfiguration&gt;(Configuration.GetSection(&quot;EmailConfiguration&quot;).Get&lt;EmailConfiguration&gt;());
              services.AddTransient&lt;IEmailService, EmailService&gt;();
              services.AddSingleton&lt;IEmailSender, EmailSender&gt;();
  
              services.AddControllers().AddNewtonsoftJson(options =&gt;
                  options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
  
              services.AddIdentity&lt;RecipeCompendiumToolUser, IdentityRole&gt;()
                  .AddEntityFrameworkStores&lt;RecipeCompendiumToolContext&gt;()
                  .AddDefaultTokenProviders();
  
              services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0)
                  .AddRazorPagesOptions(options =&gt;
                  {
                      options.Conventions.AuthorizeAreaFolder(&quot;Identity&quot;, &quot;/Account/Manage&quot;);
                      options.Conventions.AuthorizeAreaPage(&quot;Identity&quot;, &quot;/Account/Logout&quot;);
                  });
  
  
              if (Environment.IsDevelopment())
              {
                  services.AddRazorPages().AddRazorRuntimeCompilation();
  
                  services.AddDbContext&lt;RecipeCompendiumToolContext&gt;(options =&gt;
                          options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)));
              }
              else if (Environment.IsStaging())
              {
                  services.AddRazorPages().AddRazorRuntimeCompilation();
  
                  services.AddDbContext&lt;RecipeCompendiumToolContext&gt;(options =&gt;
                          options.UseSqlServer(Configuration.GetConnectionString(&quot;TestConnection&quot;)));
              }
              else if (Environment.IsProduction())
              {
                  services.AddDbContext&lt;RecipeCompendiumToolContext&gt;(options =&gt;
                          options.UseSqlServer(Configuration.GetConnectionString(&quot;ProdConnection&quot;)));
              }
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)//, RecipeCompendiumToolSeedData seeder)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
              else
              {
                  app.UseExceptionHandler(&quot;/Home/Error&quot;);
                  // TODO: The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                  app.UseHsts();
              }
              app.UseHttpsRedirection();
              app.UseStaticFiles();
  
              app.UseRouting();
  
              app.UseAuthentication();
              app.UseAuthorization();
  
              //seeder.InitializeSeedData();
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllerRoute(
                      name: &quot;default&quot;,
                      pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;);
                  endpoints.MapRazorPages();
                  endpoints.MapControllers();
              });
          }
      }
  </code></pre>