Asp.net-core – ASP.NET Core: How to change IIS Express port

asp.net-core

I'm using IIS Express to host my website and API both of which are ASP.NET Core apps. When I look at my HTTP network logs using Fiddler, I always forget what port belongs to which app. To solve this, I would like to change the port number that my apps currently use to a number that is more memorable.

For example, I want my UI website to use port 50000 and my internal API to use 50001.

Intuition tells me to change the "sslPort" and "launchUrl" to 50000 and 50001 respectively but that doesn't work.

For example, this is my current launchSettings.json file for my ASP.NET

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iis": {
      "applicationUrl": "http://localhost",
      "sslPort": 0
    },
    "iisExpress": {
      "applicationUrl": "http://localhost:29751",
      "sslPort": 44371
    }
  },
  "profiles": {
    "Development": {
      "commandName": "IISExpress",
      "launchUrl": "https://localhost:44371/"
    }
  }
} 

Changing it to this doesn't work

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iis": {
      "applicationUrl": "http://localhost",
      "sslPort": 0
    },
    "iisExpress": {
      "applicationUrl": "http://localhost:29751",
      "sslPort": 50000
    }
  },
  "profiles": {
    "Development": {
      "commandName": "IISExpress",
      "launchUrl": "https://localhost:50000/"
    }
  }
} 

Question: Why doesn't this change work? How do I change the port number?

Many thanks…

Best Answer

I found the solution. When changing the SSL port number, it must be within 44300 - 44399 otherwise it won't work. Reference: developercommunity.visualstudio.com/comments/43139/view.html. @Tseng, please remove the "duplicate" flag

Related Topic