Recently in the area of research on automating deployment, Linux can be deployed directly using Jenkins and Ansible, a little bit less in Windows, and the Appcmd tool was discovered during the search. Appcmd as a new management command after Windows IIS7.0, the function is very powerful, the key is the modification is directly effective.
The tool default location is under:%systemroot%\system32\inetsrv\, that is, under C:\Windows\System32\inetsrv\. Microsoft did not put it inside the command table and needed the file directory to run. If you want to run the Appcmd command directly, you need to add a path to the path of the system variable under environment variables.
I. Creating a Web site
Create a new site named 123, where the ID is 2, listen on port 81 for all IP addresses, of course
can be set to the IP itself, the port is followed by the hostname or domain name, of course, you can not add, the port after the colon must be added, otherwise the port will not be effective. PhysicalPath is the location of the directory that already exists.
According to the official note, name must be specified, the ID is arbitrary, not specified automatically according to the current existing deferred generation, host name can also be arbitrary.
Appcmd Add Site/name:123/id:2/bindings:http/: 81:iistest-1.tech.xyauto.com/physicalpath:d:\site\123
The following is an additional sub-station to 123
Appcmd Add app/site.name:123/path:/456/phtsicalpath:d:\site\123\456
If you do not specify the PhysicalPath parameter, or if you want to add another virtual directory, you can use this command
Appcmd add Vdir/app.name: "123/456"/path:/vdir1/physicalpath:d:\site\123\567
View the properties of the site and display it as text.
Appcmd List Site "123"/text:
When you create a Web site, you associate the default application pool, which is best managed by creating a corresponding application pool.
Two. Create an app pool
Create an application pool named 123 and 456, and then associate
Appcmd Add apppool/name:123
Appcmd Add apppool/name:456
Appcmd set App "123/"/applicationpool:123
Appcmd set App "123/456"/applicationpool:456 #由于456是123的子站, so add Master station 123.
Then take a look at the application pool.
Three. Configure Site Properties
Check the configuration parameters of the site first
Appcmd List Site "123"/text:
Modify Properties Command:
Appcmd set Site "123/"/tracefailedrequestslogging.enable:true #其他的参数可以参考一下, to first look at the attributes belonging to a few levels, some of the depth of the hierarchy, I need to add a lot of heads in front of you. For example: ftpserver.connections.datachanneltimeout:60 This will add two head.
Four. Configure application pool Properties
1, first check the current default application pool configuration information
Appcmd list AppPool "DefaultAppPool"/text:*
Appcmd set AppPool "DefaultAppPool"/queuelength:65535 #这是修改队列长度 is essential in IIS optimization.
Appcmd set AppPool "DefaultAppPool"/cpu.limit:2 #这里多了一个cpu. Because the regular configuration can be configured directly, the others need to be added to the category.
IIS automated Deployment Research-management tools Appcmd