sslPort in launchsetting.json only works with port 44308 - ASPNETCORE MVC

ASR 671 Reputation points
2023-02-01T17:45:37.97+00:00

Below is my launchsettings.json file.

When I define sslPort 44308. I am able to browse https://localhost:44308.

But if I define any other port let's say "44309". It is not working and browser throwing error stating "This site can't be reached. Local host refuse to connect".

Any reason, it is only working with 44308 and not with other port even for 443.

{
  "iisSettings": {
    "iisExpress": {
      "applicationUrl": "http://localhost:53425",
      "sslPort": 44308
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress"
    }
  }
}

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,157 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ASR 671 Reputation points
    2023-02-02T09:15:03.2866667+00:00

    I check if ports are in use, but ports were available.

    Looks like some temp file issue from visual studio. Every time we change sslPort port we have to clean and rebuild solution and it start working after after.

    0 comments No comments

  2. Angelo Albertazzi 0 Reputation points
    2023-08-29T12:35:26.2733333+00:00

    From documentation:

    https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/handling-url-binding-failures-in-iis-express#using-a-custom-ssl-port

    If you want to test SSL access to your site, you can do this with IIS Express by using an SSL port between 44300 and 44399 and using the IIS Express self-signed certificate. Actually range is from 44300 to 44398.

    Trying to use SSL with a port outside this range results in a URL binding failure when your website is launched under IIS Express.

    0 comments No comments