• IIS7.5 APPCMD 简单用法及示例


    1 添加应用程序进城池

    appcmd.exe add apppool  /name:test.com  /managedRuntimeVersion:"v4.0" /managedPipelineMode:"Integrated"

    2 添加站点,指定站点名,绑定,物理路径 

    appcmd.exe add site /name:"test.com"  /id:1 /bindings:http/*:81:  /physicalpath:"E:webroottest.comWeb"  

    3 指定站点的进城池

    appcmd.exe set site /site.name:"test.com/[path='/'].applicationPool:test.com

    4 指定站点的默认文档为index.aspx

    appcmd.exe set config "test.com/" /section:defaultDocument /+files.[@start,value='index.aspx'] /commit:"test.com"

    5 把特定目录的脚本执行权限关闭

    appcmd set config "test.com/Download" /section:handlers /accessPolicy:Read

    6导出一个机器上的所有应用进程池

    %windir%/system32/inetsrv/appcmd list apppool /config /xml > c:/apppools.xml

    7 导出1个机器上的所有站点

     %windir%/system32/inetsrv/appcmd list site /config /xml > c:/sites.xml

    8 导入所有进程池

    %windir%/system32/inetsrv/appcmd add apppool /in < c:/apppools.xml

    9 导入所有站点

    %windir%/system32/inetsrv/appcmd add site /in < c:/sites.xml

    以下是批处理脚本

    10 给站点文件授权

    ICACLS e:webroot est.com  /inheritance:e /grant:R "IIS AppPool est.com":R 

    ICACLS e:webroot est.com*  /inheritance:e /grant:R "IIS AppPool est.com":R 

    ICACLS e:webroot est.comdownload   /grant:M "IIS AppPool est.com":R

    ICACLS e:webroot est.comdownload*   /grant:M "IIS AppPool est.com":R 

    *******************************************************
    set Sitename=test.com
    set SitePath=E:webroot	est.com
    set LogPath=G:logfile
    set defaultDocument='index.aspx'
    set Is32BitApp =False
    set BackPort=99
    set netversion=v4.0
    set Cache=Cache
    %windir%system32inetsrvAppcmd add apppool  /name:%Sitename%  /managedRuntimeVersion:%netversion% /managedPipelineMode:"Integrated" /enable32BitAppOnWin64:False
    %windir%system32inetsrvAppcmd add site /name:"%Sitename%"  /id:100 /bindings:http/*:%BackPort%:,http/*:80:%sitename%  /physicalpath:%SitePath% /logfile.directory:%LogPath%
    %windir%system32inetsrvAppcmd set site /site.name:"%Sitename%" /[path='/'].applicationPool:%Sitename%
    %windir%system32inetsrvAppcmd set config "%Sitename%/" /section:defaultDocument /+files.[@start,value=%defaultDocument%] /commit:"%Sitename%"
    ICACLS %SitePath% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%* /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    *******************************************************
    set Sitename=test.com
    set SitePath=E:webroot	est.com
    set LogPath=G:logfile
    set defaultDocument='index.aspx'
    set Is32BitApp =False
    set BackPort=99
    set netversion=v4.0
    set Cache=Cache
    %windir%system32inetsrvAppcmd add apppool  /name:%Sitename%  /managedRuntimeVersion:%netversion% /managedPipelineMode:"Integrated" /enable32BitAppOnWin64:False
    %windir%system32inetsrvAppcmd add site /name:"%Sitename%"  /id:100 /bindings:http/*:%BackPort%:,http/*:80:%sitename%  /physicalpath:%SitePath% /logfile.directory:%LogPath%
    %windir%system32inetsrvAppcmd set site /site.name:"%Sitename%" /[path='/'].applicationPool:%Sitename%
    %windir%system32inetsrvAppcmd set config "%Sitename%/" /section:defaultDocument /+files.[@start,value=%defaultDocument%] /commit:"%Sitename%"
    ICACLS %SitePath% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%* /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    ICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R
    

      

  • 相关阅读:
    WebService 通过POST方式访问时候,因 URL 意外地以“/方法名”结束,请求格式无法识别 解决办法
    SQL Server 触发器
    JS数据类型转换
    .net注册到IIS
    SQL Server 常用sql操作语句
    浅解DLL
    有关注册表API函数
    [原]惜 时
    图解双机共享ADSL上网
    如何在C#中使用全局鼠标、键盘Hook
  • 原文地址:https://www.cnblogs.com/94YY/p/4542711.html
Copyright © 2020-2023  润新知