IIS腳本自動(dòng)化部署方式
所需要工具:appcmd.exe 此工具不需要單獨(dú)安裝,與iis一起安裝的。此工具所在目錄“C:\Windows\System32\inetsrv”
官方幫助文檔appcmd.exe部署iis文站點(diǎn)示例:(復(fù)制此代碼保存為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)生成iis命令部署腳本:(此處只給講解工具的使用,不詳細(xì)講解每一個(gè)屬性什么意思,這個(gè)自己去查文檔研究)
打開(kāi) 《配置編輯器》
這個(gè)節(jié)點(diǎn)內(nèi)容較多,自己選擇需要配置節(jié)點(diǎ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脫衣機(jī)

Video Face Swap
使用我們完全免費(fèi)的人工智能換臉工具輕松在任何視頻中換臉!

熱門文章

熱工具

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

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

禪工作室 13.0.1
功能強(qiáng)大的PHP集成開(kāi)發(fā)環(huán)境

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

SublimeText3 Mac版
神級(jí)代碼編輯軟件(SublimeText3)

HighCPUusageinIISworkerprocessesistypicallycausedbyinefficientcode,poorconfiguration,orunexpectedtrafficpatterns.Todiagnosetheissue,firstidentifythespecificw3wp.exeprocessusinghighCPUviaTaskManagerorResourceMonitoranddetermineitsassociatedapplication

加固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重寫(xiě)隱藏真實(shí)路徑;4.啟用HTTPS并強(qiáng)制跳轉(zhuǎn),同時(shí)設(shè)置HSTS、X-Content-Type-Options等安全響應(yīng)頭;5.定期更新系統(tǒng)補(bǔ)丁,開(kāi)啟日志記錄并使用工具分析異常訪問(wèn)行為。通過(guò)這些措施可有效防范SQL注入、XSS、目錄遍歷等常見(jiàn)攻擊方式,提升服務(wù)器整體安全性。

要限制客戶端請(qǐng)求的大小,可在web.config中修改的maxAllowedContentLength參數(shù),如設(shè)置為104857600(100MB),同時(shí)同步ASP.NET的maxRequestLength;要合理設(shè)置連接超時(shí)時(shí)間,可通過(guò)IIS管理器或appcmd.exe命令修改,默認(rèn)120秒,API場(chǎng)景建議設(shè)為30-90秒;若請(qǐng)求隊(duì)列滿了,可增加MaxClientConn和QueueLength、優(yōu)化應(yīng)用性能、啟用負(fù)載均衡來(lái)緩解壓力。

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)整配置以獲得最佳效益。

Yes,youcanuseARRwithIISasareverseproxybyfollowingthesesteps:firstinstallARRandURLRewriteviaWebPlatformInstallerormanually;nextenableproxyfunctionalityinIISManagerunderARRsettings;thenconfigurereverseproxyrulestospecifywhichrequeststoforwardtobackends

遇到IIS500錯(cuò)誤時(shí),1.首先檢查Web.config文件是否有語(yǔ)法錯(cuò)誤或配置沖突,如標(biāo)簽不閉合或重復(fù)配置;2.確認(rèn)應(yīng)用程序池狀態(tài)及設(shè)置是否正確,包括運(yùn)行狀態(tài)、.NETCLR版本和訪問(wèn)權(quán)限;3.開(kāi)啟詳細(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ò)誤的具體原因。

toenableandcustomizedirectorybrowsinginiis,first installandEnablEtheDirectoryBrowsingFeatureViaserVerveAserManagerAndiismanager; Next,castureizeTheAppearanceSheiceHeaderheaderAnderAnderAndFooterHtmlSnippets;
