4

I created a basic Asp.net core 2.0 web application in the following way:

New Application => ASP.Net Core Web Application => Web Application => (MVC) => Change Authentication => Individual User Accounts (With docker enabled)

Debugging this will give you this:

enter image description here

This will obviously give you a 404, if you get rid of https://localhost:44360/ then the application is debugging there. I've seen this answer, but this didn't work for me.

I created a hosting.json as the answer suggested:

{
  "server": "Microsoft.AspNetCore.Server.Kestrel",
  "server.urls": "http://localhost:4000"
}

I added this to the Configure() method in startup:

var config = new ConfigurationBuilder()
            .AddJsonFile("/app/hosting.json", optional: false)
            .AddEnvironmentVariables(prefix: "ASPNETCORE_")
            .Build();
        var host = new WebHostBuilder()
            .UseConfiguration(config)
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .Build();
host.Run();

This didn't fix my startup issue. What am I doing wrong or what do i need to do to fix this debug issue?

1 Answers1

4

I was seeing the same issue after creating a new project and installing Docker for Windows with Visual Studio Community 2017.

It appears that the docker-compose Property Pages had a bad Service URL property, which in my case was generated as: http://localhost:{ServicePort}/https://localhost:44339/

To fix the issue:

  • Right-click the docker-compose project
  • Select Properties
  • Replace Service URL with: http://localhost:{ServicePort}
dperish
  • 1,493
  • 16
  • 27
  • 1
    Same here - and this is Visual Studio 2019 with all updates applied running a .NET 5 ASP.NET Core Web App for Razor. Come on Microsoft; fix this issue :-) – gimlichael Apr 30 '21 at 21:06