Asp.net
使用 appcmd 添加新站點而不提供站點 ID?
我正在編寫一個批處理腳本來部署與 Visual Studio 2010 打包的網站。在腳本中,我正在添加新網站:
appcmd add site /name:MySite /id:123但是,我不想指定站點 ID。我只想
appcmd為我隨機分配一個。但是id參數是必需的appcmd,那麼我該如何解決呢?
我從來不知道需要 /id 參數 - 我一直使用以下形式:
appcmd add site /name:"%appName%" /bindings:http://%appDns%:80 /physicalPath:"%mainApplicationPath%"而且從來沒有任何問題。當您未指定 appcmd 時,它會給您什麼錯誤?
使用 appcmd 幫助,輸入
%systemroot%\system32\inetsrv\APPCMD add site /?你會看到只需要 name 參數,這是輸出的一部分:
$$ w:\kanta $$%systemroot%\system32\inetsrv\APPCMD 添加站點 /? 添加新的虛擬站點 APPCMD 添加站點 <-parameter1:value1 …>
使用指定的設置創建一個新的虛擬站點。至少,必須提供站點名稱和 ID。
支持的參數:
/名稱(必填)
Site name/ID
Site id/綁定
List of bindings in the friendly form of "http://domain:port,..." or raw form of "protocol/bindingInformation,..."/物理路徑
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