无法使用REST API创建azure云服务

时间:2014-07-31 15:51:34

标签: api azure

我正在尝试使用C#应用程序中的REST API创建Azure云服务。用于描述服务的XML是:

<CreateHostedService xmlns="http://schemas.microsoft.com/windowsazure">
  <ServiceName>AppHostingCloudService</ServiceName>
  <Label>base64-encoded-label-of-cloud-service</Label>
  <Description>This cloud service will host VMs</Description>
  <Location>Western-Europe</Location>
</CreateHostedService>

我确实使用正确的证书正确设置了所有标头,所有,我得到一个HTTP 400错误,说错误请求,这里是错误的详细信息:

+       response    {StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Date: Thu, 31 Jul 2014 15:49:45 GMT
  Server: Microsoft-HTTPAPI/2.0
  Content-Length: 220
  Content-Type: application/xml; charset=utf-8
}}  System.Net.Http.HttpResponseMessage

任何想法,

由于

1 个答案:

答案 0 :(得分:0)

400错误通常意味着您正在发送的XML出现问题。最有可能的是它是数据中心位置的名称。您可能希望通过执行List Locations操作获取地理列表,并查看西欧数据中心的正确位置名称。