使用msdeploy从命令行在远程计算机上安装zip-package

时间:2014-02-21 10:01:44

标签: msdeploy

我有一个.zip包,我想在我的开发机器上安装在开发服务器上。所以我使用msdeploy为我自动执行此操作。

msdeploy.exe -verb:sync -source:package=Debug_Services_14.02.20.1413.zip -dest:auto,computername=DEVELOPMENTSERVER,username=ADMIN_USER,password=ADMIN_PWD

但它没有说出ERROR_SITE_DOESNT_EXIST。

Info: Adding sitemanifest (sitemanifest).
Info: Adding createApp (MY_SERVICE).
Info: Adding contentPath (MY_SERVICE).
Error Code: ERROR_SITE_DOES_NOT_EXIST
More Information: Site MY_SERVICE does not exist.  Learn more at: http
://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST.
Error count: 1.

但我是第一次尝试安装它!我错过了什么?

1 个答案:

答案 0 :(得分:0)

例如。 msdeploy api c#。 Execute MSDeploy from C# program code like an API

public static void AppSynchronization(DeploymentBaseOptions depBaseOptions, string       appPath)
{
    var deploymentObjectSyncApp = DeploymentManager.CreateObject(
        DeploymentWellKnownProvider.Package,
        appPath, new DeploymentBaseOptions());

    deploymentObjectSyncApp.SyncTo(DeploymentWellKnownProvider.Auto, string.Empty,
        depBaseOptions, new DeploymentSyncOptions());
}

,其中

var deployBaseOptions = new DeploymentBaseOptions
            {
                ComputerName = @"https://WIN-CCDDFDFDFD:8172/msdeploy.axd",
                UserName = @"WIN-CCDDFDFDFD\Al",
                Password = "1212121",
                AuthenticationType = "Basic"
            };
appPath = "C:\mySite.zip";