在Visual Studio 2015社区RTM中为ASP.NET 5项目启用SSL [英] Enabling SSL for ASP.NET 5 project in Visual Studio 2015 Community RTM

查看:100
本文介绍了在Visual Studio 2015社区RTM中为ASP.NET 5项目启用SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数教程建议您可以通过转到项目的属性,然后选中启用SSL"复选框来为网站启用SSL.但是,对于我在Visual Studio 2015社区(Microsoft Visual Studio社区2015版本14.0.23107.0 D14REL)中的ASP.NET 5项目,该选项不存在(请参见屏幕快照

Most tutorials suggest that you can enable SSL for the website by going to properties of the project and then ticking the "Enable SSL" checkbox. However for my ASP.NET 5 projects in Visual Studio 2015 Community (Microsoft Visual Studio Community 2015 Version 14.0.23107.0 D14REL) this option doesn't exist (see the screenshot ).

我能够通过在applicationhost.config中手动添加https协议绑定来解决此问题(遵循

I was able to workaround it by manually adding https protocol binding in applicationhost.config (following pre-RTM instruction in https://github.com/AzureADSamples/WebApp-OpenIdConnect-AspNet5), but I found out that Visual Studio is overwriting this file from time to time, which forces me to do the manual edit over and over again.

当我创建一个新的Web应用程序项目时,启用SSL"仅在使用ASP.NET 4.5模板时可用,而在使用ASP.NET 5 Preview模板时不可用.有没有办法以持久的方式为ASP.NET 5项目配置此选项?

When I create a new Web application project, the "Enable SSL" is available only when I use ASP.NET 4.5 templates, but not when I use ASP.NET 5 Preview templates. Is there a way to configure this option for ASP.NET 5 projects in a way that persists?

推荐答案

RTM,RC2& RC1答案

您需要在项目的properties文件夹中使用launchSettings.json.请注意sslPort设置.请注意,对于RC1,ASPNETCORE_ENVIRONMENT变为Hosting:Environment.

RTM, RC2 & RC1 Answer

You need to use launchSettings.json in the properties folder of the project. Note the sslPort setting. Note that for RC1 ASPNETCORE_ENVIRONMENT becomes Hosting:Environment.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:1025/",
      "sslPort": 44300
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

测试版8回答

您可以编辑.xproj文件并添加SSLPort元素以手动添加它,但这实际上适用于任何版本的VS,我建议您在

Beta 8 Answer

You can edit the .xproj file and add the SSLPort element to add it manually but this should really be available to any version of VS and I'd advise you to raise an issue on the ASP.NET Tooling GitHub page:

<PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
    <DevelopmentServerPort>1025</DevelopmentServerPort>
    <SSLPort>44300</SSLPort>
</PropertyGroup>

端口号必须是介于44300和44399之间的数字.

The port number must be a number between 44300 and 44399.

这篇关于在Visual Studio 2015社区RTM中为ASP.NET 5项目启用SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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