Where do I specify my SSL port for IISExpress?

2020-08-13 08:23发布

问题:

OK, so I used to be able to change the SSL port number in the project properties dialog, but after the asp.net 5 RC1 update, the SSL field is read-only:

It ignores the SSLPort value when I attempt to edit the .xproj directly:

<PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
    <DevelopmentServerPort>17204</DevelopmentServerPort>
    <SSLPort>44303</SSLPort>
  </PropertyGroup>

And it also resets the port in my app host config file ($[solutionDir].vs\config\applicationhost.config) back to the original value when I change the binding and launch my project.

        <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>

What gives? Where is Visual Studio getting this value from, and how do I change it?

回答1:

Open launchSettings.json under the ./Properties folder. The int value in iisSettings > iisExpress > sslPort is where it's read from. You can change that value to whatever you want.

{
  "iisSettings": {
    "iisExpress": {
      "sslPort": <ssl-port-value>
    }
  }
}