简体   繁体   中英

Using appcmd to add a new site without supplying site id?

I'm writing a batch script to deploy web sites packaged with Visual Studio 2010. In the script, I'm adding new sites as such:

appcmd add site /name:MySite /id:123

However, I don't want to specify a site id. I would just like appcmd to randomly assign one for me. But the id parameter is required for appcmd , so how do I go around about it?

I've never known the /id param to be required - I've always used the form:

appcmd add site /name:"%appName%" /bindings:http://%appDns%:80 /physicalPath:"%mainApplicationPath%"

And never had any problems. What error is appcmd giving you when you don't specify it?

Use appcmd help, type

%systemroot%\system32\inetsrv\APPCMD add site /?

And you will see that only name parameter is required, here is the part of that output:

[w:\\kanta]%systemroot%\\system32\\inetsrv\\APPCMD add site /? Add new virtual site

APPCMD add SITE <-parameter1:value1 ...>

Creates a new virtual site with the specified settings. At minimum, the site name and id must be provided.

Supported parameters:

/name (required)

 Site name 

/id

 Site id 

/bindings

 List of bindings in the friendly form of "http://domain:port,..." or raw form of "protocol/bindingInformation,..." 

/physicalPath

 If specified, will cause the root application containing a root virtual directory pointing to the specified path to be created for this site. If omitted, the site is created without a root application and will not be startable until one is created. 

/?

 Display the dynamic site properties that can be set on the new site 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM