请求下层服务失败

Request to a downlevel service failed

我正在尝试使用 REST APIs 创建服务总线命名空间。下面是我的代码:

var uri = string.Format("https://management.core.windows.net/{0}/services/ServiceBus/Namespaces/{1}", subscriptionId, sericebusToCreate);    
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "PUT";
request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + token);
request.Headers.Add("x-ms-version", "2014-10-01");

var requestContent = @"<NamespaceDescription xmlns=""http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">
<Name>" + sericebusToCreate + @"</Name>
<Region>Southeast Asia</Region><ServiceBusEndpoint>https://configpoc.servicebus.windows.net/</ServiceBusEndpoint>                      <SubscriptionId>My-subscription</SubscriptionId><Critical>false</Critical>              <EventHubEnabled>true</EventHubEnabled>     <NamespaceType>Messaging</NamespaceType></NamespaceDescription>";
var requestBytes = new ASCIIEncoding().GetBytes(requestContent);
request.ContentType = "application/atom+xml";
request.ContentLength = requestBytes.Length;
var requestStream = request.GetRequestStream();
requestStream.Write(requestBytes, 0, requestBytes.Length);

try
{                
var response = (HttpWebResponse)request.GetResponse();
using (var stream = new StreamReader(response.GetResponseStream()))
{
//Do something with response
}
catch (WebException ex)
{
var err = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
Console.WriteLine(err);
}

为了获取身份验证令牌,我正在使用 this 方法。我可以确认此方法有效,因为我能够使用其他 REST API,例如获取命名空间等。

当我执行代码时,出现 "Request to a downlevel service failed" 错误。

我从 google 那里得到的帮助很少。似乎很少有人遇到过这个问题。谁能解释一下是什么导致了这个问题,我该如何解决?

虽然我永远无法弄清楚这个错误的原因,但我确实找到了另一种使用 Azure Service Bus Management APIs 创建服务总线的方法。它使用起来更简单,并且可以按预期工作。

必须注意,这个库目前是 "Pre-Release" 版本。