zoukankan      html  css  js  c++  java
  • [2015-11-23]分享一个批处理脚本,创建iis站点及程序池


    建站批处理

    batch_createSites.bat

    @echo off
    rem 以管理员身份执行本脚本,可添加多条call 以建立多个站点
    call path	ocreateSites.bat www com.yourdomain yourdomain.com d:Sites
    pause
    

    createSites.bat

    @echo off
    rem 以管理员身份执行本脚本
    
    set domain_id=%1
    set site_name_prefix=%2
    set domain_postfix=%3
    set root_path=%4
    
    set site_name=%site_name_prefix%.%domain_id%
    echo %site_name%
    set domain_name=%domain_id%.%domain_postfix%
    echo %domain_name%
    set physical_Path=%root_path%\%site_name%
    echo %physical_Path%
    mkdir %physical_Path%
    
     inetsrvappcmd add site /name:%site_name% /physicalPath:%physical_Path% /bindings:http/*:80:%domain_name%
     inetsrvappcmd add apppool /name:%site_name% /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated
     inetsrvappcmd set site /site.name:%site_name% /[path='/'].applicationPool:%site_name%
    
    rem 以下两行用于删除站点和应用程序池
    rem inetsrvappcmd delete site /site.name:%site_name%
    rem inetsrvappcmd delete apppool /apppool.name:%site_name%
    
    pause
    

    常用appcmd命令

    解锁config文件

    inetsrvappcmd unlock config -section:system.webServer/modules
    inetsrvappcmd unlock config -section:system.webServer/handlers
    

    列出所有iis站点

    inetsrvappcmd list site
    

    启用预加载和AlwaysRunning

    inetsrvappcmd set apppool %apppool_name% /startMode:AlwaysRunning
    inetsrvappcmd set site %site_name% /applicationDefaults.preloadEnabled:True
    

    批量设置站点启用预加载

    C:Windowssystem32>inetsrvappcmd list app /xml|%systemroot%system32inetsrvappcmd set site /in /applicationDefaults.preloadEnabled:True
    

    批量设置应用程序池AlwaysRunning

    C:Windowssystem32>inetsrvappcmd.exe list app /xml|%systemroot%system32inetsrvappcmd set apppool /in /startMode:AlwaysRunning
  • 相关阅读:
    进程锁和进程池(附线程池)
    Python多进程
    queue队列
    随笔:python3+yagmail邮件发送,简单易操作
    随笔:用python的pip命令时却显示没有提供命令:Did not provide a command
    随笔:python+selenium+unittest用qq邮箱上传文件并发送邮件
    随笔:用HtmlTestRunner生成报告
    随笔:Linux里mysql的tar包安装
    Performance Testing 前期准备以及场景设计
    Performance Testing 入门小结
  • 原文地址:https://www.cnblogs.com/personball/p/7455898.html
Copyright © 2011-2022 走看看