IIS腳本自動(dòng)化部署方式
所需工具:appcmd.exe 此工具不需要單獨(dú)安裝,與iis一起安裝的。此工具所在目錄「C:\Windows\System32\inetsrv」
官方說(shuō)明文件appcmd.exe部署iis文網(wǎng)站範(fàn)例:(複製此程式碼儲(chǔ)存為bat檔就能執(zhí)行使用)
推薦(免費(fèi)):IIS
::跳到iis命令工具所在目錄下? cd?C:\Windows\System32\inetsrv ::刪除指定web站點(diǎn) appcmd.exe?delete?site?"Default?Web?Site" appcmd.exe?delete?site?"ppsweb" ::刪除指定應(yīng)用程序池 appcmd?delete?apppool?"ppsweb" appcmd?delete?apppool?"ppswebservice" appcmd?delete?apppool?"ChartPic" appcmd?delete?apppool?"PipelinePath" ::添加應(yīng)用程序池 appcmd?add?apppool?/name:"ppsweb" ::修改應(yīng)用程序池啟動(dòng)模式 appcmd.exe?set?APPPOOL?"ppsweb"?/config?/startMode:"AlwaysRunning"??/commit:apphost ::修改應(yīng)用程序池標(biāo)示 appcmd.exe?set?APPPOOL?"ppsweb"?/processModel.identityType:"SpecificUser"?/processModel.userName:"*****"?/processModel.password:"*****"??/commit:apphost ::設(shè)置固定時(shí)間間隔回收應(yīng)用程序池 appcmd.exe?set?APPPOOL?"ppsweb"?/recycling.periodicRestart.time:"00:00:00"??/commit:apphost ::設(shè)置指定時(shí)間回收應(yīng)用程序池 appcmd.exe?set?APPPOOL?"ppsweb"?/+"recycling.periodicRestart.schedule.[value='00:30:00']"?/commit:apphost ::關(guān)閉快速故障防護(hù)功能 appcmd.exe?set?APPPOOL?"ppsweb"?/failure.rapidFailProtection:"False"??/commit:apphost appcmd?add?apppool?/name:"ppswebservice" appcmd.exe?set?APPPOOL?"ppswebservice"?/config?/startMode:"AlwaysRunning"??/commit:apphost appcmd.exe?set?APPPOOL?"ppswebservice"?/processModel.identityType:"SpecificUser"?/processModel.userName:"*****"?/processModel.password:"*****"??/commit:apphost appcmd.exe?set?APPPOOL?"ppswebservice"?/recycling.periodicRestart.time:"00:00:00"??/commit:apphost appcmd.exe?set?APPPOOL?"ppswebservice"?/+"recycling.periodicRestart.schedule.[value='00:30:00']"?/commit:apphost appcmd.exe?set?APPPOOL?"ppswebservice"?/failure.rapidFailProtection:"False"??/commit:apphost appcmd.exe?set?APPPOOL?"ppswebservice"?/enable32BitAppOnWin64:"True"??/commit:apphost ::添加web站點(diǎn) appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True']"?/commit:apphost ::綁定端口訪問(wèn)方式 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].bindings.[protocol='http',bindingInformation='*:80:']"?/commit:apphost ::綁定端口訪問(wèn)方式 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].bindings.[protocol='https',bindingInformation='*:443:']"?/commit:apphost ::添加web站點(diǎn)默認(rèn)運(yùn)行路徑和應(yīng)用程序池 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].[path='/',applicationPool='ppsweb',serviceAutoStartEnabled='True',preloadEnabled='True']"?/commit:apphost ::添加web站點(diǎn)的應(yīng)程序路徑 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].[path='/',applicationPool='ppsweb',serviceAutoStartEnabled='True',preloadEnabled='True'].[path='/',physicalPath='C:\inetpub\wwwroot\ppsweb']"?/commit:apphost ::添加web子站點(diǎn)方式 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].[path='/WebService',applicationPool='ppswebservice',serviceAutoStartEnabled='True',preloadEnabled='True']"?/commit:apphost appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].[path='/WebService',applicationPool='ppswebservice',serviceAutoStartEnabled='True',preloadEnabled='True'].[path='/',physicalPath='C:\inetpub\wwwroot\ppsweb\WebService']"?/commit:apphost ::修改web站點(diǎn)單個(gè)請(qǐng)求的大小 appcmd.exe?set?config??-section:system.webServer/asp?/limits.maxRequestEntityAllowed:"20000000"??/commit:apphost ::修改web站點(diǎn)允許上傳單個(gè)文件大小 appcmd.exe?set?config??-section:system.webServer/serverRuntime?/uploadReadAheadSize:"20971520"??/commit:apphost pause
3、使用工具自動(dòng)產(chǎn)生iis指令部署腳本:(此處只給講解工具的使用,不詳細(xì)講解每一個(gè)屬性什麼意思,這個(gè)自己去查文檔研究)
打開《配置編輯器》
這個(gè)節(jié)點(diǎn)內(nèi)容較多,自己選擇需要配置節(jié)點(diǎn)。幫助文件
這就是產(chǎn)生的腳本,有多種語(yǔ)言腳本(C#、javaScript、APPCmd、PowerShell),在這裡我比較熟悉AppCmd命令列,所以我選擇命令列腳本,你也可以選擇其他語(yǔ)言腳本,看你對(duì)哪個(gè)語(yǔ)言腳本熟悉就選哪一個(gè)。
以上是介紹IIS腳本自動(dòng)化部署方式的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

熱AI工具

Undress AI Tool
免費(fèi)脫衣圖片

Undresser.AI Undress
人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強(qiáng)大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6
視覺化網(wǎng)頁(yè)開發(fā)工具

SublimeText3 Mac版
神級(jí)程式碼編輯軟體(SublimeText3)

熱門話題

加固IIS安全需五步:1.禁用不必要的功能和服務(wù),如WebDAV、FTP等;2.關(guān)閉默認(rèn)網(wǎng)站和測(cè)試頁(yè)面,刪除或禁止訪問(wèn)無(wú)用腳本目錄;3.配置請(qǐng)求過(guò)濾規(guī)則,阻止非法擴(kuò)展名、目錄遍歷和超長(zhǎng)URL,並使用URL重寫隱藏真實(shí)路徑;4.啟用HTTPS並強(qiáng)制跳轉(zhuǎn),同時(shí)設(shè)置HSTS、X-Content-Type-Options等安全響應(yīng)頭;5.定期更新系統(tǒng)補(bǔ)丁,開啟日誌記錄並使用工具分析異常訪問(wèn)行為。通過(guò)這些措施可有效防範(fàn)SQL注入、XSS、目錄遍歷等常見攻擊方式,提升服務(wù)器整體安全性。

VirtualDirectories andApplicationsIniisDifferIntiendEctionceanDconfiguration.1.VirtualDirectoriesActasAliaseSaleStoExterneContent,sharingTheparentsite'sapplication'sapplicationplicationPoolandConfiguration,Ideal fororganizingStaticFilesFilesFilesFilesFilesFilesWithOutDuplication.2.application.2.applicationsrunindepe

在IIS中配置動(dòng)態(tài)壓縮時(shí),合理選擇內(nèi)容類型能提升性能。首先啟用動(dòng)態(tài)壓縮模塊,通過(guò)服務(wù)器管理器安裝並配置web.config或IIS管理器。其次設(shè)置合適的內(nèi)容類型,如HTML、CSS、JavaScript和JSON等文本類內(nèi)容適合壓縮,圖片和視頻則不適合。最後注意客戶端兼容性和性能影響,監(jiān)控CPU負(fù)載、客戶端支持情況及小文件壓縮效果,並結(jié)合實(shí)際流量調(diào)整配置以獲得最佳效益。

HighCPUusageinIISworkerprocessesistypicallycausedbyinefficientcode,poorconfiguration,orunexpectedtrafficpatterns.Todiagnosetheissue,firstidentifythespecificw3wp.exeprocessusinghighCPUviaTaskManagerorResourceMonitoranddetermineitsassociatedapplication

遇到IIS500錯(cuò)誤時(shí),1.首先檢查Web.config文件是否有語(yǔ)法錯(cuò)誤或配置衝突,如標(biāo)籤不閉合或重複配置;2.確認(rèn)應(yīng)用程序池狀態(tài)及設(shè)置是否正確,包括運(yùn)行狀態(tài)、.NETCLR版本和訪問(wèn)權(quán)限;3.開啟詳細(xì)錯(cuò)誤信息以獲取具體錯(cuò)誤線索,可通過(guò)IIS管理器或web.config配置實(shí)現(xiàn);4.檢查代碼異常及依賴項(xiàng)問(wèn)題,如數(shù)據(jù)庫(kù)連接失敗、DLL缺失或未處理的後端異常。以上步驟有助於精準(zhǔn)定位並解決導(dǎo)致500錯(cuò)誤的具體原因。

要解決IIS應(yīng)用程序池身份驗(yàn)證賬戶權(quán)限問(wèn)題,首先需確認(rèn)應(yīng)用池使用的身份賬戶,默認(rèn)為IISAppPool{AppPoolName},可通過(guò)IIS管理器查看或修改;其次,確保該賬戶對(duì)網(wǎng)站物理路徑(如D:\MyWebSite)具有相應(yīng)權(quán)限,操作步驟為:右鍵文件夾→屬性→安全→編輯→添加對(duì)應(yīng)賬戶並設(shè)置讀取、寫入等權(quán)限;常見錯(cuò)誤如401.3是因缺少讀取權(quán)限,500.19可能是web.config文件權(quán)限不足,上傳失敗則可能是缺少寫入權(quán)限;注意繼承權(quán)限是否生效、UNC路徑需配置用戶名密碼,以及修改後可能需要

Yes,youcanuseARRwithIISasareverseproxybyfollowingthesesteps:firstinstallARRandURLRewriteviaWebPlatformInstallerormanually;nextenableproxyfunctionalityinIISManagerunderARRsettings;thenconfigurereverseproxyrulestospecifywhichrequeststoforwardtobackends

ToensureIISapplicationpoolsrunsmoothlyandavoidwebappissues,followthesesteps:1)RegularlycheckapplicationpoolstatusinIISManagerandrestartanystoppedpoolswhileinvestigatingtherootcauseusinglogsorEventViewer;2)Configureautomaticrecyclingbasedonmemoryortim
