gpt4 book ai didi

带有 Visual Studio 2015 的 ASP.NET 网站 SSL

转载 作者:太空宇宙 更新时间:2023-11-03 14:39:16 27 4
gpt4 key购买 nike

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

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

我一直在网络上上下搜索有关如何正确启用 SSL 的指南。

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

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

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

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

我的查询实际上是..

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

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

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

我尝试使用开始 URL,但它根本不起作用。我想也许是 IIS 阻止它工作。我知道我一定做错了什么。我比较了属性页窗口,它与我从其他人那里看到的不同..

查询 3,

enter image description here

这些是我用于 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>

一路上可能会有更多疑问..我现在能想到的只是我认为我做错了的基础和基础知识..

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

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

最佳答案

在 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>

关于带有 Visual Studio 2015 的 ASP.NET 网站 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44660046/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com