简体   繁体   English

带有Visual Studio 2015的ASP.NET WebSite SSL

[英]ASP.NET WebSite SSL with Visual Studio 2015

I'm currently working on a ASP.NET WebSite Security Project in School. 我目前正在学校进行ASP.NET网站安全项目。

My objective is to start up my website with the URL of HTTPS, securing it with SSL. 我的目标是使用HTTPS的URL来启动我的网站,并使用SSL对其进行保护。

I have been researching high and low over the net for guidance on how to properly enable SSL. 我一直在网上进行大量研究,以获取有关如何正确启用SSL的指导。

I'm using VISUAL STUDIO 2015 , and i have seen that the project properties can automatically enable SSL and then create a self-signed certificate. 我正在使用VISUAL STUDIO 2015 ,并且我已经看到项目属性可以自动启用SSL,然后创建一个自签名证书。

I have actually gotten my website to be running at a URL - https://localhost:443/Example.aspx 我实际上已经使我的网站在URL下运行-https:// localhost:443 / Example.aspx

It worked.. Then i played around with it here and there and i realised it requires VS 2015 to be run as administrator for it to work.. 它起作用了。然后我到处都在使用它,我意识到它需要以管理员身份运行VS 2015才能起作用。

But i'm not sure if i'm setting up the SSL properly.. 但是我不确定我是否正确设置了SSL。

My queries are actually.. 我的查询实际上是..

  1. How do i properly set up SSL for my project using self signed certificate, with makecert to create a localhost certificate and assigning port 443 via IIS (Default WebSite bindings) ? 如何使用自签名证书为我的项目正确设置SSL,并使用makecert创建本地证书并通过IIS(默认WebSite绑定)分配端口443?
  2. How do i set the start up URL to be HTTPS? 如何将启动URL设置为HTTPS?
  3. Do i have to enabled SSL for my project? 我必须为我的项目启用SSL吗?

For query 2, i have actually researched, and many stated that, right clicking on my project then Property Pages -> Start Options -> Configure from there. 对于查询2,我实际上进行了研究,许多人指出,右键单击我的项目,然后单击“属性页”->“启动选项”->“从此处配置”。

But this is actually what i get.. 但这实际上是我得到的。

I tried playing around with the Start URL but it doesn't work at all.. I think maybe IIS is preventing it from working.. And i know there must be of something that i'm doing wrongly.. And i compared the Property Pages window and it's different from what i see from others.. 我尝试使用“开始URL”,但它根本不起作用。。我认为IIS可能阻止了它的工作。。而且我知道某些地方我做错了。页面窗口,它与我从其他人看到的窗口不同。

Query 3, 查询3,

在此处输入图片说明

These are the codes i used for my Web.Config file. 这些是我用于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>  

Inside my applicationhost.config file 在我的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>

Might have more queries along the way.. All i can think of now is the foundation and fundamentals which i have done wrongly i presume.. 一路上可能会有更多疑问。.我现在能想到的就是我认为做错了的基础和基本原理。

Everything is messy.. I sincerely apologise.. I tried my best to search for what i can but to no avail.. 一切都乱七八糟..我由衷的歉意..我尽力寻找我能但没有用的..

Really appreciate any procedural help.. 非常感谢任何程序上的帮助。

In Web.Config: 在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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM