IIS7 CMD command

Source: Internet
Author: User

Don't talk nonsense! Although there is a configuration interface manager! However, creating commands during installation packages is essential! Recently, I have carefully studied the Appcmd command by using NSIS to create an installation package, which is fully functional.

I checked some information online, and most of those blogs were reposted by others. These are some basic introductions, and many commands have not been introduced (I don't know if it's just me ).

Even Microsoft's technical resource library is not detailed:

Attachment address: http://technet.microsoft.com/zh-cn/library/cc772200 (WS.10). aspx (I found it again anyway! I cannot find what I want)

 

I will not introduce some of Microsoft's technical resource libraries. Click the above link to view them.

(This section describes some of the commands we can use. Currently, only site operations are included. Other apppool config app vdir will be added later)

 

I. Preparations

APPcmd.exe is located in the C: \ Windows \ System32 \ inetsrv directory

Use Cd c: \ Windows \ System32 \ inetsrv to switch to this directory

 

Ii. Command operations

Basic Format of IIS Command Line management tool:

APPCMD (command) (Object Type) <identifier> </parameter 1: value 1...>

Supported object types:

SITE Virtual SITE Management
APP management application
VDIR manage virtual directories
APPPOOL management application pool
CONFIG Management general configuration section
WP management process
REQUEST to manage HTTP requests
MODULE Management Server MODULE
BACKUP management server configuration BACKUP
TRACE logs using failed requests

----------- This is not explained in detail. Anyone who knows this knows the level of IIS.

 

 

III.SiteCommand details

1. Command Introduction

Virtual Site Management

APPCMD <command> SITE [identifier] [-parameter 1: value 1...] example: appcmd list site (list existing sites)

Supported commands:

List virtual sites
Set Virtual Site Configuration
Add new Virtual Site
Delete Virtual Site
Start
Stop Virtual Site

2. Detailed explanation

List virtual sites

APPCMD list SITE [identifier] [-parameter 1: value 1...]

List virtual sites on a computer. This command can be used to search for the site using the identifier or url of a specific site, or
Matches zero or multiple sites based on specified site attributes.

Example:

Appcmd list sites

Lists all sites on a computer.

Appcmd list site "Default Web Site"

Find the Site "Default Web Site ".

Appcmd list site http: // localhost/app1

Find the site associated with the specified url.

Appcmd list site/serverAutoStart: false

Find all sites whose "serverAutoStart" configuration property is set to "false.

Add new Virtual Site

APPCMD add SITE [identifier] [-parameter 1: value 1...]

Use the specified settings to create a new virtual site. At least, the site name and ID must be provided.

Supported parameters:

/Name (required) site name

/Id site ID

/Bindings "http: // domain: port,..." indicates the binding list in the format of protocol/bindingInformation ,... ".

/PhysicalPath

If this parameter is specified, a root application containing the root virtual directory pointing to the specified path will be created for the site. If
A site without a root application will be created and cannot be started before the root application is created.

Example:

Appcmd add site/name: "My New Site"/id: 2/bindings: http://www.domain.com: 80

Use the specified note binding to create a new site "My new site" to listen to www. d on port 80.
Omain.com.

Appcmd add site/name: "My New Site"/id: 2/bindings: http: // *: 81

Use the specified note binding to create a new site "My new site" to listen to any domain on port 81
Name of the http request.

Appcmd add site/name: "My New Site"/id: 2/bindings: http/*: 81:

Use the specified ID and bind it to create a new site "My new site ". After creation, the new site does not contain any applications
Program.

Appcmd add site/name: "My New Site"/id: 2/bindings: http/*: 81:/physicalPath: "c
: \ Inetpub \ mynewsite"

Use the specified ID and bind it to create a new site "My new site ". The system automatically creates a root virtual directory pointing
Specifies the root application of the physical path.

Appcmd add site/name: "My New Site"/bindings: http/*: 81:

Use bind to create a new site "My new site" and automatically generate a site ID. The new site does not contain
Any application.

 

Configure a Virtual Site

APPCMD set SITE [identifier] [-parameter 1: value 1...]

Allows you to set the attributes of a specified virtual site. You must provide an accurate site identifier and resolve it to the current
There are sites.

Supported parameters:

Identifier (required)

Site name or url of the site to be modified

/Site. name

The name or url of the site to be modified (same as the identifier)

/Bindings

"Http: // domain: port,..." to remember the format or "protocol/bindingInformation,..." original
Format binding list

Example:

Appcmd set site "Default Web Site"/serverAutoStart: false/id: 100

Set the "serverAutoStart" and "id" attributes of the "Default Web Site" Site.

Some advanced operations (important) are attached to the set operation)

When appcmd set site "Default Web Site" was used, other advanced Parameters

The explanation will be supplemented later ............

-Name
-Id ID
-Whether serverAutoStart is automatically started
-Bindings. [protocol = 'string', bindingInformation = 'string']. p
-Bindings. [protocol = 'string', bindingInformation = 'string']. B
-Limits. maxBandwidth
-Limits. maxConnections
-Limits. connectionTimeout
-LogFile. logExtFileFlags
-LogFile. customLogPluginClsid
-LogFile. logFormat
-LogFile. directory
-LogFile. period
-LogFile. truncateSize
-LogFile. localTimeRollover
-LogFile. enabled
-TraceFailedRequestsLogging. enabled
-TraceFailedRequestsLogging. directory
-TraceFailedRequestsLogging. maxLogFiles
-TraceFailedRequestsLogging. maxLogFileSizeKB
-TraceFailedRequestsLogging. customActionsEnabled
-ApplicationDefaults. path
-ApplicationDefaults. applicationPool
-ApplicationDefaults. enabledProtocols
-VirtualDirectoryDefaults. path
-VirtualDirectoryDefaults. physicalPath: the physical path of the website.
-VirtualDirectoryDefaults. userName: Account of the physical path credential
-VirtualDirectoryDefaults. password: password of the physical path credential
-VirtualDirectoryDefaults. logonMethod
-VirtualDirectoryDefaults. allowSubDirConfig
-[Path = 'string']. path
-[Path = 'string']. applicationPool
-[Path = 'string']. enabledProtocols
-[Path = 'string']. virtualDirectoryDefaults. path
-[Path = 'string']. virtualDirectoryDefaults. physicalPath
-[Path = 'string']. virtualDirectoryDefaults. userName
-[Path = 'string']. virtualDirectoryDefaults. password
-[Path = 'string']. virtualDirectoryDefaults. logonMethod
-[Path = 'string']. virtualDirectoryDefaults. allowSubDirConfig
-[Path = 'string']. [path = 'string']. path
-[Path = 'string']. [path = 'string']. physicalPath
-[Path = 'string']. [path = 'string']. userName
-[Path = 'string']. [path = 'string']. password
-[Path = 'string']. [path = 'string']. logonMethod
-[Path = 'string']. [path = 'string']. allowSubDirConfig

Delete A Virtual Site

APPCMD delete SITE [identifier] [-parameter 1: value 1...]

Description: deletes a specified virtual site from a computer. An accurate site identifier must be provided and resolved to an existing site.

Supported parameters:

Identifier (required) Name or url of the site to be deleted

/Site. name the site name or url of the site to be deleted (same as the identifier)

Example:

Appcmd delete site "Default Web Site" delete Site "Default Web site ".

 

Start a Virtual Site

APPCMD start SITE [identifier] [-parameter 1: value 1...]

Start a specified virtual site and enable it to start listening for new requests from all its bound endpoints. An accurate site identifier must be provided and resolved to an existing site.

Supported parameters:

Identifier (required) Name or url of the site to be started

/Site. name the site name or url of the site to be started (same as the identifier)

Example:

Appcmd start site "Default Web Site"

Start the Site "Default Web Site ".

 

Stop a Virtual Site

APPCMD stop SITE [identifier] [-parameter 1: value 1...]

Stop a specified virtual site and stop receiving new requests from its bound endpoint. Must provide an accurate site identifier and
The identifier must be resolved to an existing site.

Supported parameters:

Identifier (required) Name or url of the site to be stopped

/Site. name the site name or url of the site to be stopped (same as the identifier)

Example:

Appcmd stop site "Default Web Site"

Stop the Site "Default Web Site ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.