大多数教程建议您可以通过转到项目的属性,然后选中“启用SSL”复选框来为网站启用SSL。但是,对于我在Visual Studio 2015社区(Microsoft Visual Studio社区2015版本14.0.23107.0 D14REL)中的ASP.NET 5项目,该选项不存在(请参见屏幕截图)。
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.
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?
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"
}
}
}
}
您可以编辑.xproj文件并添加SSLPort
要手动添加的元素,但这实际上应适用于任何版本的VS,我建议您在ASP.NET Tooling GitHub页面上提出问题:
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>1025</DevelopmentServerPort>
<SSLPort>44300</SSLPort>
</PropertyGroup>
端口号必须是44300和44399之间的数字。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句