Azure ManagementClient.Subscriptions.Get()永远挂起。需要解决方法

时间:2016-10-25 22:53:04

标签: azure hang

我每次尝试调用ManagementClient.Subscriptions.Get()都会永远挂起。 如果我将其更改为ManagementClient.Subscriptions.GetAsync(),并在其自己的线程上运行它,该任务将永远保持在WaitingForActivation状态。

有什么建议吗?

示例代码:(它是挂起的最后一行。)

using System;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Management;
using Microsoft.WindowsAzure.Management.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;

class Program1
{
    static void Main1(string[] args)
    {
        AuthenticationContext context = new AuthenticationContext(...);
        AuthenticationResult authResult = context.AcquireToken(...);
        TokenCloudCredentials token = new TokenCloudCredentials(authResult.AccessToken);
        ManagementClient client = new ManagementClient(token);
        SubscriptionGetResponse subresp = client.Subscriptions.Get();
    }
}

提前致谢。

1 个答案:

答案 0 :(得分:0)

显然,Subscriptions.Get和朋友都缺少错误恢复。我的问题是context.AcquireToken中的网址错误了。我有#34; https://management.core.windows.net",但需要" https://management.core.windows.net/" (即尾随斜线完全不同。)