IIS script automated deployment method
Required tools: appcmd.exe This tool No need to install it separately, it is installed together with iis. The directory where this tool is located is "C:\Windows\System32\inetsrv"
Official Help Documentappcmd.exe Deployment of IIS Website Example: (Copy this code and save it as a bat file Can be executed and used)
Recommended (free): IIS
::跳到iis命令工具所在目錄下? cd?C:\Windows\System32\inetsrv ::刪除指定web站點 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)用程序池啟動模式 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è)置固定時間間隔回收應(yīng)用程序池 appcmd.exe?set?APPPOOL?"ppsweb"?/recycling.periodicRestart.time:"00:00:00"??/commit:apphost ::設(shè)置指定時間回收應(yīng)用程序池 appcmd.exe?set?APPPOOL?"ppsweb"?/+"recycling.periodicRestart.schedule.[value='00:30:00']"?/commit:apphost ::關(guān)閉快速故障防護功能 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站點 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True']"?/commit:apphost ::綁定端口訪問方式 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].bindings.[protocol='http',bindingInformation='*:80:']"?/commit:apphost ::綁定端口訪問方式 appcmd.exe?set?config??-section:system.applicationHost/sites?/+"[name='ppsweb',id='2',serverAutoStart='True'].bindings.[protocol='https',bindingInformation='*:443:']"?/commit:apphost ::添加web站點默認運行路徑和應(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站點的應(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子站點方式 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站點單個請求的大小 appcmd.exe?set?config??-section:system.webServer/asp?/limits.maxRequestEntityAllowed:"20000000"??/commit:apphost ::修改web站點允許上傳單個文件大小 appcmd.exe?set?config??-section:system.webServer/serverRuntime?/uploadReadAheadSize:"20971520"??/commit:apphost pause
3. Use tools to automatically generate iis command deployment Script: (Here we only explain the use of the tool, and do not explain in detail what each attribute means. You can check the documentation and research this yourself)
Open the "Configuration Editor"
The content of this node is relatively small. There are many, you can choose the nodes you need to configure. Help document
This is the generated script. There are multiple language scripts (C#, javaScript, APPCmd, PowerShell). Here I am more familiar with the AppCmd ??command line, so I choose the command line script. You can also You can choose other language scripts, whichever language script you are familiar with.
The above is the detailed content of Introducing the automatic deployment method of IIS scripts. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Strengthening IIS security requires five steps: 1. Disable unnecessary functions and services, such as WebDAV, FTP, etc.; 2. Close the default website and test pages, delete or prohibit access to useless script directories; 3. Configure request filtering rules to prevent illegal extensions, directory traversal and super long URLs, and use URLs to rewrite and hide the real path; 4. Enable HTTPS and force jumps, and set security response headers such as HSTS, X-Content-Type-Options; 5. Regularly update system patches, enable logging and use tools to analyze abnormal access behavior. Through these measures, we can effectively prevent common attack methods such as SQL injection, XSS, directory traversal, and improve the overall security of the server.

VirtualdirectoriesandapplicationsinIISdifferinindependenceandconfiguration.1.Virtualdirectoriesactasaliasestoexternalcontent,sharingtheparentsite’sapplicationpoolandconfiguration,idealfororganizingstaticfileswithoutduplication.2.Applicationsrunindepe

When configuring dynamic compression in IIS, selecting content types reasonably can improve performance. First enable the dynamic compression module, install and configure web.config or IIS manager through the server manager. Secondly, set appropriate content types, such as HTML, CSS, JavaScript, and JSON, text content is suitable for compression, while pictures and videos are not suitable. Finally, pay attention to the impact of client compatibility and performance, monitor CPU load, client support status and small file compression effects, and adjust the configuration based on actual traffic to obtain the best benefits.

HighCPUusageinIISworkerprocessesistypicallycausedbyinefficientcode,poorconfiguration,orunexpectedtrafficpatterns.Todiagnosetheissue,firstidentifythespecificw3wp.exeprocessusinghighCPUviaTaskManagerorResourceMonitoranddetermineitsassociatedapplication

When encountering an IIS500 error, 1. First check whether the Web.config file has syntax errors or configuration conflicts, such as the tag is not closed or repeated configuration; 2. Confirm whether the application pool status and settings are correct, including the running status, .NETCLR version and access permissions; 3. Turn on detailed error information to obtain specific error clues, which can be implemented through IIS manager or web.config configuration; 4. Check for code exceptions and dependency problems, such as database connection failure, DLL missing or unhandled backend exceptions. The above steps help accurately locate and resolve the specific causes of 500 errors.

To solve the IIS application pool authentication account permission problem, first, you need to confirm the identity account used by the application pool. The default is IISAppPool{AppPoolName}, which can be viewed or modified through the IIS manager; secondly, make sure that the account has corresponding permissions to the website physical path (such as D:\MyWebSite). The operation steps are: Right-click the folder → Properties → Security → Edit → Add the corresponding account and set the read, write and other permissions; common errors such as 401.3 is due to lack of read permission, 500.19 may be due to insufficient permissions for web.config file, and failure to upload may be due to lack of write permissions; pay attention to whether the inheritance permissions are effective, the UNC path needs to be configured with a username and password, and it may be necessary to modify it after the username and password.

Yes,youcanuseARRwithIISasareverseproxybyfollowingthesesteps:firstinstallARRandURLRewriteviaWebPlatformInstallerormanually;nextenableproxyfunctionalityinIISManagerunderARRsettings;thenconfigurereverseproxyrulestospecifywhichrequeststoforwardtobackends

ToensureIISapplicationpoolsrunsmoothlyandavoidwebappissues,followthesesteps:1)RegularlycheckapplicationpoolstatusinIISManagerandrestartanystoppedpoolswhileinvestigatingtherootcauseusinglogsorEventViewer;2)Configureautomaticrecyclingbasedonmemoryortim
