代码之家  ›  专栏  ›  技术社区  ›  burnt1ce

ASP.NET核心:如何更改IIS Express端口?

  •  0
  • burnt1ce  · 技术社区  · 7 年前

    我正在使用IIS Express托管我的网站和API,它们都是ASP.NET核心应用程序。当我使用Fiddler查看HTTP网络日志时,我总是忘记哪个端口属于哪个应用程序。为了解决这个问题,我想将我的应用程序当前使用的端口号更改为一个更令人难忘的号码。

    直觉告诉我将“sslPort”和“launchUrl”分别更改为50000和50001,但这不起作用。

    launchSettings.json 我的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/"
        }
      }
    } 
    

    换成这个不行

    {
      "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/"
        }
      }
    } 
    

    问题:

    非常感谢。。。

    1 回复  |  直到 7 年前
        1
  •  16
  •   Alex C    7 年前

    我找到了解决办法。更改SSL端口号时,它必须在44300-44399之间,否则将无法工作。参考: developercommunity.visualstudio.com/comments/43139/view.html

    推荐文章