批量绑定几千个域名

1.此处服务器针对的是Windows系列,其他如Linux也是一样的道理

2.说下思路,其实很简单,就是直接操作IIS的配置文件。

3.IIS配置文件位置在C:\Windows\System32\inetsrv\config\applicationHost.config。注意:(各个版本之间的节点内容有些不一样,里面最核心一句都一样

4.<binding protocol=\"http\" bindingInformation=\"{IP地址}:{端口}:{域名}\" /> 这句就是绑定的关键句子了,当然还有绑定网站文件物理路径等,你们自己去看看就可以了。

5.下面这个xml就是一个websie的全面内容

<site name="p1" id="2" serverAutoStart="true">
    <application path="/" applicationPool="p1">
        <virtualDirectory path="/" physicalPath="E:\publish" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="192.168.16.23:88:" />
        <binding protocol="http" bindingInformation="*:88:" />
    </bindings>
</site>

6.剩下的代码就简单了,直接操作config文档就好了,代码你们自己撸吧,不难。

posted @ 2024-03-23 14:32  AlbertSmith  阅读(13)  评论(0编辑  收藏  举报