【问题标题】:ASP.NET WebSite SSL with Visual Studio 2015带有 Visual Studio 2015 的 ASP.NET 网站 SSL
【发布时间】:2017-06-20 17:59:26
【问题描述】:

我目前在学校从事 ASP.NET 网站安全项目。

我的目标是使用 HTTPS 的 URL 启动我的网站,并使用 SSL 保护它。

我一直在网上研究如何正确启用 SSL 的指导。

我正在使用VISUAL STUDIO 2015,我看到项目属性可以自动启用SSL,然后创建一个自签名证书。

我实际上已经让我的网站在一个 URL 上运行 - https://localhost:443/Example.aspx

它工作了.. 然后我到处玩它,我意识到它需要以管理员身份运行 VS 2015 才能工作..

但我不确定我是否正确设置了 SSL..

我的查询实际上是..

  1. 如何使用自签名证书为我的项目正确设置 SSL,使用 makecert 创建 localhost 证书并通过 IIS(默认网站绑定)分配端口 443?
  2. 如何将启动 URL 设置为 HTTPS?
  3. 我必须为我的项目启用 SSL 吗?

对于查询 2,我实际进行了研究,许多人表示,右键单击我的项目,然后单击属性页 -> 开始选项 -> 从那里配置。

但这实际上是我得到的..

我尝试使用 Start URL,但它根本不起作用..我认为 IIS 可能会阻止它工作..而且我知道一定有什么我做错了..我比较了“属性页”窗口,它与我从其他人看到的不同..

查询 3,

这些是我用于 Web.Config 文件的代码。

<system.webServer>
  <!--<modules runAllManagedModulesForAllRequests="true" >
    <remove name="UrlRoutingModule"/>
  </modules>-->
  <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  </modules>
</system.webServer>  

在我的 applicationhost.config 文件中

<site name="FinancialHub" id="2">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\Dom\Documents\Visual Studio 2015\WebSites\FinancialHub" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:6868:localhost" />
                <binding protocol="https" bindingInformation="*:443:localhost" />
            </bindings>
        </site>

在此过程中可能会有更多疑问..我现在所能想到的只是我认为我做错了的基础和基本原理..

一切都乱七八糟..我真诚地道歉..我尽力寻找我能找到的但无济于事..

非常感谢任何程序帮助..

【问题讨论】:

    标签: asp.net ssl visual-studio-2015 https web


    【解决方案1】:

    在 Web.Config 中:

    <system.webServer>    
      <rewrite>
        <rules>
          <rule name="Redirect to https" enabled="True">
             <match url="(.*)"/>
             <conditions>
                <add input="{HTTPS}" pattern="Off"/>
             </conditions>
             <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>
           </rule>                   
         </rules>
        </rewrite>    
    </system.webServer> 
    

    【讨论】:

    • 感谢您的回复。我做了你所说的,我收到了一个错误。在我的帖子中添加了图片。
    猜你喜欢
    • 2018-03-28
    • 1970-01-01
    • 2015-11-18
    • 2016-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-22
    • 1970-01-01
    相关资源
    最近更新 更多