IIS7.5 APPCMD 簡單用法及樣本

來源:互聯網
上載者:User

標籤:iis7 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.comset SitePath=E:\webroot\test.comset LogPath=G:\logfileset defaultDocument=‘index.aspx‘set Is32BitApp =Falseset BackPort=99set netversion=v4.0set 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%":RICACLS %SitePath%\* /inheritance:e /grant:R "IIS AppPool\%SiteName%":RICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":RICACLS %SitePath%\%Cache% /inheritance:e /grant:R "IIS AppPool\%SiteName%":R



本文出自 “skybug” 部落格,請務必保留此出處http://skybug.blog.51cto.com/132577/1592050

IIS7.5 APPCMD 簡單用法及樣本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.