在哪里为IISExpress指定我的SSL端口?

Jar*_*rem 8 asp.net ssl asp.net-core

好的,所以我曾经能够在项目属性对话框中更改SSL端口号,但在asp.net 5 RC1更新之后,SSL字段是只读的:

在此输入图像描述

当我尝试直接编辑.xproj时,它会忽略SSLPort值:

<PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
    <DevelopmentServerPort>17204</DevelopmentServerPort>
    <SSLPort>44303</SSLPort>
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

当我更改绑定并启动我的项目时,它还会将我的应用程序主机配置文件($ [solutionDir] .vs\config\applicationhost.config)中的端口重置为原始值.

        <site name="WebApplication1" id="8">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\WebApplication1\wwwroot" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:17833:localhost" />
                <binding protocol="https" bindingInformation="*:44303:localhost" />
            </bindings>
        </site>
Run Code Online (Sandbox Code Playgroud)

是什么赋予了?Visual Studio从哪里获取此值,以及如何更改它?

Dea*_*ane 12

launchSettings.json在./Properties文件夹下打开.iisSettings> iisExpress> sslPort中的int值是从中读取的值.您可以将该值更改为您想要的任何值.

{
  "iisSettings": {
    "iisExpress": {
      "sslPort": <ssl-port-value>
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

  • IISExpress 必须在 44300-44399 范围内才能真正启用 SSL。如果你输入 6000 之类的东西,那么它就不起作用,你会得到一个空白页。显然,您可以使用任何以管理员身份运行的端口。https://docs.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-without-administrative-privileges (11认同)