配置IIS Express以使用http和https的默认端口进行调试

时间:2012-04-12 07:18:51

标签: asp.net visual-studio-2010 iis ssl iis-express

关于如何为http和https分别启用默认端口(80和443),我已关注scot's article。我已经按照每一步跟踪信件,最后IIS express sytem托盘显示我的网站正在以下网址上运行

enter image description here

我唯一不同的做法是使用netsh>advfirewall>firewall上下文,因为它告诉我netsh firewall已被弃用。我使用以下命令允许端口80通过防火墙

netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80 

以下是IIS Express的applicationhost.config文件中的相关站点部分

<site name="SSLTest" id="4">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="G:\Adeel\SSLTest\SSLTest" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:51518:localhost" />
                    <binding protocol="https" bindingInformation="*:44301:localhost" />
                    <binding protocol="http" bindingInformation="*:80:mhlabs" />
                  <binding protocol="https" bindingInformation="*:443:mhlabs" />
                </bindings>
            </site>

编辑:问题是,当我浏览到http:/ mhlabs或https:/ mhlabs时,它无效。我找不到浏览器的页面。我怎么能解决这个问题 Edit2:好的,作为第一步,我想忘记ssl并在端口80上保留测试一个网址并在此网址上运行我的网站。我想到的逻辑步骤是我使用netsh http add urlacl url=http://test-one:80/ user=everyone保留一个URL,并在applicationhost.config文件的bindings部分添加此条目。我还允许端口80通过防火墙,但整件事似乎对我没用。有什么想法吗?

1 个答案:

答案 0 :(得分:4)

您是从命令行启动iis express还是使用WebMatrix?

如果您没有从命令行启动它,请尝试执行以下步骤,看看是否存在任何绑定错误。

  1. 启动命令提示符,转到iis express安装文件夹&#39;%programfiles%\ iis express&#39;

  2. 运行以下命令

    iisexpress.exe / site:SSLTest

  3. 如果有任何绑定注册失败,您会看到一些错误消息。 如果&#39; mhlabs&#39;有任何错误绑定注册,请确保您的URL保留正确。 URL预留命令应如下所示

    netsh http add urlacl url = http:// mhlabs:80 / user = everyone