zoukankan      html  css  js  c++  java
  • 使用批处理自动发布IIS站点,基于IIS7及以上

    经过研究,终于使用批处理解决了站点发布步骤多的问题。

    完整批处理如下:

    @set "sitePath=%~dp0"
    
    @echo 新建程序池
    @C:WindowsSystem32inetsrvappcmd.exe add apppool /name:"新程序池" /managedRuntimeVersion:"v4.0"
    @C:WindowsSystem32inetsrvappcmd.exe stop site "Default Web Site"
    @C:WindowsSystem32inetsrvappcmd.exe add site /name:"新站点" /bindings:http/*:80: /applicationDefaults.applicationPool:"新程序池" /physicalPath:%sitePath%
    
    Pause
    

      

    将上面的批处理代码保存成bat文件,放在要发布的网站文件夹的根目录下,右键,以管理员身份运行即可。

    详解:

    set "sitePath=%~dp0" 得到批处理文件所在目录,由于批处理文件放在网站跟目录下,所以即是得到网站的完整目录路径。
    C:WindowsSystem32inetsrvappcmd.exe add apppool /name:"新程序池" /managedRuntimeVersion:"v4.0"
    新建程序池,不多说。

    C:WindowsSystem32inetsrvappcmd.exe stop site "Default Web Site"
    停止默认站点,主要是我做的时候,要求默认站点停止掉,以让出80端口。可以根据自己需要是否要停止默认站点。

    C:WindowsSystem32inetsrvappcmd.exe add site /name:"新站点" /bindings:http/*:80: /applicationDefaults.applicationPool:"新程序池" /physicalPath:%sitePath%
    新建站点,指定名称,
    /bindings:访问地址及端口绑定。指定程序池。
    /applicationDefaults.applicationPool:指定程序池
    /physicalPath:指定网站文件目录。
    大概就这么点了。反正不复杂,还可以指定更多的站点配置。相关的配置就请大家自行查找了。

  • 相关阅读:
    ELK搭建
    php 高效日志记录扩展seaslog 的使用
    linux批量修改文件中包含字符串的查找替换
    goaccess
    mysql启动错误,提示crash 错误
    laravel config 配置无效
    地址重写 No input file specified的解决方法
    redis 一些操作命令
    RNN与LSTM
    最大熵推导LR
  • 原文地址:https://www.cnblogs.com/nidongde/p/5198057.html
Copyright © 2011-2022 走看看