Visual Studio 2015/IISExpress更改SSL端口 [英] Visual Studio 2015 / IISExpress change SSL port

查看:104
本文介绍了Visual Studio 2015/IISExpress更改SSL端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个项目,一个Web API和一个客户端angularJS项目(使用Empty Project模板创建).我的客户要求我强制使用SSL,因此为Web API创建了filterAttribute. 无论如何,我将两个项目都更改为启用SSL".问题是,两个项目都显示其SSL URL为 http://localhost:44300 显然行不通.

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 created a filterAttribute. Anyway, I changed both projects to be SSL Enabled. The problem is, both projects show their SSL URL to be http://localhost:44300 which obviously won't work.

因此,我决定更改applicationhost.config文件. 对于Visual Studio 2015,它似乎位于 .vs 文件夹中.当我在其中进行更改时,如果打开我的项目,它将覆盖它并将其放回 44300 .

So I decided to change the applicationhost.config file. For Visual Studio 2015, this appears to be in the .vs folder. When I change it in there, if I open my project it overwrites it and puts it back to 44300.

我尝试创建一个虚拟目录(在API的属性中),并且尝试覆盖应用程序的根URL. 都不起作用.

I tried creating a virtual directory (in the properties of my API) and I tried to override the application root URL. Neither worked.

有人知道我如何使用其他SSL端口吗?

Does anyone know how I can use a different SSL port?

推荐答案

我在2个项目中的情况相同. Visual Studio 2015正确为HTTP分配了不同的URL端口号,但将两个项目都映射到了HTTPS的44300.

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 .vs \ config中的applicationhost.config似乎定义了IIS Express环境,并告诉IIS Express调用时的行为.此信息不会反馈到Visual Studio.

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似乎依赖于.csproj文件中的设置.这是在VS中查看项目属性时看到的SSL端口值.

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. 在项目的.csproj文件中更改IISExpressSSLPort值
  2. 我还需要确保在applicationhost.config中包含https绑定

.csproj

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

applicationhost.config

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

更新:

文件 .csproj.user 也具有SSL端口配置,为避免覆盖applicationhost.config文件中的SSL端口号,也应更新.csproj.user.

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>

这篇关于Visual Studio 2015/IISExpress更改SSL端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆