Visual Studio 2015 / IISExpress change SSL port

后端 未结 3 1825
孤街浪徒
孤街浪徒 2021-02-01 14:09

I have 2 projects, a Web API and a client angularJS project (that was created using the Empty Project template). My client has asked me to force SSL, so for the Web API I create

相关标签:
3条回答
  • 2021-02-01 14:47

    For Asp.Net Core see "/Properties/launchSettings.json" file.

    0 讨论(0)
  • 2021-02-01 14:54

    I had the same situation with 2 projects. Visual Studio 2015 correctly assigned differing URL port numbers for HTTP but mapped both projects to 44300 for HTTPS.

    AFAIK the applicationhost.config in .vs\config seems to define the IIS Express environment and tell IIS Express how to behave when invoked. This information doesn't feedback into Visual Studio.

    Visual Studio appears to rely on settings in the .csproj file. This is the SSL port value you see when you look at properties for the project in VS.

    I was able untangle the two projects by adjusting both:

    1. Changing the IISExpressSSLPort value in my project's .csproj file
    2. I also needed to ensure that the https binding was included in the applicationhost.config

    .csproj

    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort>44301</IISExpressSSLPort>
    

    applicationhost.config

    <bindings>
       <binding protocol="http" bindingInformation="*:58001:localhost" />
       <binding protocol="https" bindingInformation="*:44301:localhost" />
    </bindings>
    

    Update:

    The file .csproj.user also has SSL Port configuration, to avoid the overwriting of the SSL port number in the applicationhost.config file, .csproj.user should be updated too.

    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort>44301</IISExpressSSLPort>
    
    0 讨论(0)
  • 2021-02-01 15:07

    For vs2015, I found the file applicationhost.config with the correct content under the .vs\ folder in my solution.

    0 讨论(0)
提交回复
热议问题