80端口被Default Web Site占用,不能为自己的网站添加绑定80端口

这几天租了个云服务器Windows Server 2012 R2,买了个域名,想把之前的大作业做的asp.net网站放上去试试,结果弄完发现输入域名(或ip)不加端口时默认访问80端口,而80端口又被Default Web Site占用,导致打开的是默认界面。

打开IIS管理器,想将80端口绑定在我的网站主页上,又不能点击确定。

遂上网查找找到这篇文章,发现可以直接修改文件,找到C:\Windows\System32\inetsrv\config下的applicationHost.config文件,用记事本打开,在<sites></sites>可以找到:

    <site name="Default Web Site" id="1" serverAutoStart="true">           
        <bindings>
            <binding protocol="net.tcp" bindingInformation="808:*" />
            <binding protocol="net.pipe" bindingInformation="*" />
            <binding protocol="net.msmq" bindingInformation="localhost" />
            <binding protocol="msmq.formatname" bindingInformation="localhost" />
            **<binding protocol="http" bindingInformation="*:80:" />**
        </bindings>
    </site>
	<site name="Library" id="2" serverAutoStart="true">
        <application path="/">
            <virtualDirectory path="/" physicalPath="C:\WebApp\Library" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:8080:" />
        </bindings>
    </site>

 

上面的<site> </site>是默认网站,下面是我的网站,将 <bindings></bindings>中的<binding protocol="http" bindingInformation="*:80:" />(加**的哪一行)从默认网站剪切到我们自己网站的<bindings></bindings>之间就可以解决问题了。
修改完如下

<site name="Default Web Site" id="1" serverAutoStart="true">           
    <bindings>
        <binding protocol="net.tcp" bindingInformation="808:*" />
        <binding protocol="net.pipe" bindingInformation="*" />
        <binding protocol="net.msmq" bindingInformation="localhost" />
        <binding protocol="msmq.formatname" bindingInformation="localhost" />
       
    </bindings>
</site>
<site name="Library" id="2" serverAutoStart="true">
    <application path="/">
        <virtualDirectory path="/" physicalPath="C:\WebApp\Library" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:8080:" />
        <binding protocol="http" bindingInformation="*:80:" /> 
    </bindings>
</site>

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论