Home Topics IIS Introducing the automatic deployment method of IIS scripts

Introducing the automatic deployment method of IIS scripts

Apr 26, 2021 pm 04:39 PM

Introducing the automatic deployment method of IIS scripts

IIS script automated deployment method

  1. 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 Document

  2. appcmd.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"
::删除指定应用程序池
appcmd delete apppool "ppsweb"
appcmd delete apppool "ppswebservice"
appcmd delete apppool "ChartPic"
appcmd delete apppool "PipelinePath"

::添加应用程序池
appcmd add apppool /name:"ppsweb"
::修改应用程序池启动模式
appcmd.exe set APPPOOL "ppsweb" /config /startMode:"AlwaysRunning"  /commit:apphost
::修改应用程序池标示
appcmd.exe set APPPOOL "ppsweb" /processModel.identityType:"SpecificUser" /processModel.userName:"*****" /processModel.password:"*****"  /commit:apphost
::设置固定时间间隔回收应用程序池
appcmd.exe set APPPOOL "ppsweb" /recycling.periodicRestart.time:"00:00:00"  /commit:apphost
::设置指定时间回收应用程序池
appcmd.exe set APPPOOL "ppsweb" /+"recycling.periodicRestart.schedule.[value='00:30:00']" /commit:apphost
::关闭快速故障防护功能
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站点默认运行路径和应用程序池
appcmd.exe set config  -section:system.applicationHost/sites /+"[name='ppsweb',id='2',serverAutoStart='True'].[path='/',applicationPool='ppsweb',serviceAutoStartEnabled='True',preloadEnabled='True']" /commit:apphost
::添加web站点的应程序路径
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
Copy after login

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"
Introducing the automatic deployment method of IIS scripts
The content of this node is relatively small. There are many, you can choose the nodes you need to configure. Help document
Introducing the automatic deployment method of IIS scripts
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.
Introducing the automatic deployment method of IIS scripts

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Beyond the Hype: Assessing the Role of IIS Today Beyond the Hype: Assessing the Role of IIS Today Apr 11, 2025 pm 12:25 PM

IIS remains important in today's technological environment. 1) IIS is tightly integrated with Windows systems, providing powerful management and security functions. 2) It supports advanced usage from simple website hosting to complex load balancing and SSL management. 3) Through optimization and best practices, IIS still has powerful functions and stability in enterprise and personal applications.

Is IIS a good web server? Is IIS a good web server? Apr 04, 2025 am 12:05 AM

IISisagoodwebserverforthosedeeplyintegratedintheMicrosoftecosystem,offeringscalability,security,andeaseofmanagement.However,itmaybelimitingforthoseseekingflexibilityorpreferringopen-sourcesolutions.

What companies use IIS? What companies use IIS? Apr 05, 2025 am 12:10 AM

Many well-known companies such as Microsoft, Dell, HP, Bank of America and GoDaddy use IIS. They chose IIS because of its seamless integration with Windows, high performance and scalability, security, and easy-to-manage tools. Despite the challenges of learning curve, cost and cross-platform compatibility, it can be solved with Microsoft's documentation, free trials and cross-platform solutions.

What is IIS used for? What is IIS used for? Apr 09, 2025 am 12:13 AM

IIS is a powerful web server software developed by Microsoft to host and manage websites, applications, and services. The functions of IIS include: 1) Hosting websites and web applications, supporting a variety of programming languages ​​and frameworks; 2) Providing load balancing and high availability to ensure application stability; 3) Built-in multiple security features to protect web applications; 4) Providing performance optimization tools to improve response speed; 5) Providing detailed logging and monitoring functions to help diagnose and solve problems.

Is Microsoft IIS free? Is Microsoft IIS free? Apr 08, 2025 am 12:11 AM

Microsoft's IIS does offer a free version for individual developers and small projects, but with limited functionality. 1. The free version is bundled with the Windows operating system and is suitable for individuals and small projects. 2. The paid version provides advanced features such as load balancing, suitable for projects that require high reliability and scalability. 3. When using IIS, reasonable configuration and optimization can significantly improve performance and reliability.

How many websites can IIS handle? How many websites can IIS handle? Apr 06, 2025 am 12:16 AM

There is no fixed number of websites that IIS can handle, depending on hardware configuration, server settings, and website requirements. 1. Hardware resources such as CPU, memory and disk I/O affect processing capabilities. 2. Server configuration includes application pool settings and concurrent connection count. 3. By optimizing resources and configuration, IIS can efficiently handle multiple websites.

What is the IIS server role? What is the IIS server role? Apr 02, 2025 pm 03:05 PM

The IIS server role refers to installing and configuring IIS services on a Windows server to enable it to perform the functions of a web server. 1) Install the IIS server role and use the PowerShell command: Install-WindowsFeature-nameWeb-Server-IncludeManagementTools. 2) Create a new website with PowerShell command: New-WebSite-Name"MyNewSite"-Port80-PhysicalPath"C:\inetpub\wwwroot\MyNewSite

What is the difference between Tomcat and IIS? What is the difference between Tomcat and IIS? Apr 07, 2025 am 12:14 AM

The main difference between Tomcat and IIS is the design goals and functions: 1.Tomcat is an open source servlet container suitable for JavaWeb applications. 2.IIS is developed by Microsoft and is mainly used for ASP.NET applications and is integrated into Windows systems. When choosing, you need to consider project requirements and technology stack.

See all articles