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:\webroot\test.com\Web"  

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\test.com\  /inheritance:e /grant:R "IIS AppPool\test.com":R 

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

ICACLS e:\webroot\test.com\download   /grant:M "IIS AppPool\test.com":R

ICACLS e:\webroot\test.com\download\*   /grant:M "IIS AppPool\test.com":R 

 

*******************************************************
set Sitename=test.com
set SitePath=E:\webroot\test.com
set LogPath=G:\logfile
set defaultDocument='index.aspx'
set Is32BitApp =False
set BackPort=99
set netversion=v4.0
set Cache=Cache
%windir%\system32\inetsrv\Appcmd add apppool  /name:%Sitename%  /managedRuntimeVersion:%netversion% /managedPipelineMode:"Integrated" /enable32BitAppOnWin64:False
%windir%\system32\inetsrv\Appcmd add site /name:"%Sitename%"  /id:100 /bindings:http/*:%BackPort%:,http/*:80:%sitename%  /physicalpath:%SitePath% /logfile.directory:%LogPath%
%windir%\system32\inetsrv\Appcmd set site /site.name:"%Sitename%" /[path='/'].applicationPool:%Sitename%
%windir%\system32\inetsrv\Appcmd 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\test.com
set LogPath=G:\logfile
set defaultDocument='index.aspx'
set Is32BitApp =False
set BackPort=99
set netversion=v4.0
set Cache=Cache
%windir%\system32\inetsrv\Appcmd add apppool  /name:%Sitename%  /managedRuntimeVersion:%netversion% /managedPipelineMode:"Integrated" /enable32BitAppOnWin64:False
%windir%\system32\inetsrv\Appcmd add site /name:"%Sitename%"  /id:100 /bindings:http/*:%BackPort%:,http/*:80:%sitename%  /physicalpath:%SitePath% /logfile.directory:%LogPath%
%windir%\system32\inetsrv\Appcmd set site /site.name:"%Sitename%" /[path='/'].applicationPool:%Sitename%
%windir%\system32\inetsrv\Appcmd 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

  

转载于:https://www.cnblogs.com/94YY/p/4542711.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值