1

I am running Visual Studio 2019 which uses IIS Express for Web applications. It was running fine up till suddenly a website I was working on (ASP.NET Core) crashed and gave an error. I went and fixed the error and now all I get is https://localhost:44314 can not be reached (see image 1 below). I have all the routing in the code and even reverted my code to the last working version with still no luck. I have even reinstalled Visual Studio and iisexperess. You can see my startup code below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace Website
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // 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.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {              
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

enter image description here

JD M
  • 65
  • 1
  • 1
  • 8
  • 1
    Check the debug section of your web project and make sure the port was not changed. Also check the launchSettings.json.... finally stop using IIS Express and just use kestrel for debugging. I only use IIS Express if I need something very specific to IIS... – Jonathan Alfaro Oct 15 '20 at 04:04
  • 1
    @JonathanAlfaro I still don't know why IIS Express won't work as all the things you had me try worked BUT kestrel works! I will for sure use that for now on. Thank you! – JD M Oct 15 '20 at 04:47
  • Clean your solution and then try.@JDM – ScareCrow Oct 15 '20 at 04:59
  • Do you update your OS recently? Can you share more details about the OS version you're running on? – Fei Han Oct 15 '20 at 13:48
  • @ScareCrow I tried cleaning and it didn't work – JD M Oct 15 '20 at 16:41
  • @FeiHan My OS is Windows 10 Version 1909 build 18363.1139 – JD M Oct 15 '20 at 16:43
  • You can try to check if any useful logs under `%SystemRoot%\System32\LogFiles\HTTPERR` folder. Besides, try to change 44314 to another port and check if it can work. – Fei Han Oct 20 '20 at 08:40

0 Answers0