我正在使用 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);
}