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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ******************************************************* 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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ******************************************************* 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 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
2011-05-31 //过360云查杀的代码
2011-05-31 NC反弹提权教程
2011-05-31 三个入侵的必备小工具-lcx.exe、nc.exe、sc.exe