0

我正在使用 Windows Azure 管理库来部署新的云服务。我正在尝试制作现有云服务的副本,但使用了新名称。当我尝试创建新部署时,出现以下错误:

DeployNew error: Microsoft.WindowsAzure.CloudException: ResourceNotFound: The hosted service does not exist.
   at Microsoft.WindowsAzure.Management.Compute.DeploymentOperationsExtensions.Create(IDeploymentOperations operations, String serviceName, DeploymentSlot deploymentSlot, DeploymentCreateParameters parameters)
   at XXYYZZ.DeployNew() in c:\xxyyzz\Scale.cs:line 147

REQUEST BODY:
<CreateDeployment xmlns="http://schemas.microsoft.com/windowsazure">
  <Name>simulatorprocesstrainer</Name>
  <PackageUrl>https://xxyyzz.blob.core.windows.net/deployments/XXYYZZ.cspkg</PackageUrl>
  <Label>...</Label>
  <Configuration>...</Configuration>
  <StartDeployment>true</StartDeployment>
  <ExtendedProperties />
</CreateDeployment>

RESPONSE:
HTTP/1.1  NotFound (404):  Not Found
x-ms-servedbyregion: ussouth
x-ms-request-id: 8854275254702aef8c2a84a27d23f12d
Cache-Control: no-cache
Date: Tue, 12 Nov 2013 12:11:26 GMT
Server: 1.0.6198.19
Server: (rd_rdfe_stable.131030-2145)
Server: Microsoft-HTTPAPI/2.0
client-tracking-id: 1
Content-Length: 199
Content-Type: application/xml; charset=utf-8

RESPONSE BODY:
<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">    <Code>ResourceNotFound</Code><Message>The hosted service does not exist.</Message></Error>

我有一个名为“myfirstcloudservice”的现有 clous 服务,并希望创建一个名为“myfirstcloudservice2”的新云服务作为“myfirstcloudservice”的副本。

我们使用了以下伪代码:

using (ComputeManagementClient client = CloudContext.Clients.CreateComputeManagementClient(CertificateAuthenticationHelper.GetCredentials()))
{
    var parameters = new DeploymentCreateParameters()
    {
        Label = "mypackagename",
        Name = "myfirstcloudservice2",
        PackageUri = package.Uri, // cspkg-file from myfirstcloudservice
        Configuration = configContent, // content from cscfg-file from myfirstcloudservice
        StartDeployment = true
    };

    client.Deployments.Create("myfirstcloudservice2", deploymentSlot, parameters);
}
4

1 回答 1

1

这里的问题是您试图将部署推送到不存在的云服务。在尝试部署之前,您需要确保您的代码首先创建了 myfirstcouldservice2 云服务。

使用 client.HostedServices.Create 或 CreateAsync 方法首先创建云服务。您可以在Brady Gaster的帖子中查看更多信息。

于 2013-11-12T12:49:13.867 回答