title: IIS express doesn't start but Kestrel web server instead
body: <p>My application have been working well for weeks. Today I possibly did something wrong and IIS express is not starting any more (and no errors in the event log) but Kestrel appears in a command window saying it is listening for connections on 5000th port.<br>
  How to fix it and get IIS express back?</p>
  
  <p>Startup.cs:</p>
  
  <pre><code>public class Startup
  {
      public Startup(IHostingEnvironment env)
      {
          var builder = new ConfigurationBuilder()
              .SetBasePath(env.ContentRootPath)
              .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
              .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
              .AddEnvironmentVariables();
  
          if (env.IsDevelopment())
          {
              // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
              builder.AddApplicationInsightsSettings(developerMode: true);
          }
          Configuration = builder.Build();
      }
  
      public IConfigurationRoot Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          // Add framework services.
          services.AddApplicationInsightsTelemetry(Configuration);
  
          services.AddMvc();
  
          // Add functionality to inject IOptions&lt;T&gt;
          services.AddOptions();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
      {
          loggerFactory.AddConsole(Configuration.GetSection("Logging"));
          loggerFactory.AddDebug();
  
          app.UseApplicationInsightsRequestTelemetry();
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
              app.UseBrowserLink();
          }
          else
          {
              app.UseDeveloperExceptionPage();
              app.UseExceptionHandler("/Home/Error");
          }
  
          app.UseStaticFiles();
  
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
      }
  }
  </code></pre>