【问题标题】:Method not found: 'System.Threading.Tasks.Task`1<Microsoft.Rest.ServiceClientCredentials> Microsoft.Rest.Azure.Authentication.UserTokenProvider找不到方法:'System.Threading.Tasks.Task`1<Microsoft.Rest.ServiceClientCredentials> Microsoft.Rest.Azure.Authentication.UserTokenProvider
【发布时间】:2019-08-06 07:02:32
【问题描述】:

我在下面的代码中得到突出显示的问题

     var restClient = RestClient.Configure()
                    .WithEnvironment(AzureEnvironment.AzureGlobalCloud)
                    .WithBaseUri("https://management.azure.com/")
                    .WithCredentials(creds)
                    .Build();
        var message = new HttpRequestMessage(HttpMethod.Post, url);
// getting issue in below code
       await restClient.Credentials.ProcessHttpRequestAsync(message, new System.Threading.CancellationToken(false)); 

错误:

找不到方法: 'System.Threading.Tasks.Task1<Microsoft.Rest.ServiceClientCredentials> Microsoft.Rest.Azure.Authentication.UserTokenProvider.LoginByDeviceCodeAsync(System.String, System.String, Microsoft.Rest.Azure.Authentication.ActiveDirectoryServiceSettings, Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache, System.Func2)'。

我在下面引用了最新版本的dll

Microsoft.IdentityModel.Clients.ActiveDirectory --> 版本 4.3.0.0

【问题讨论】:

    标签: c# .net azure .net-core azure-active-directory


    【解决方案1】:

    使用 .net 框架 4.6.1 安装 Microsoft.Azure.Management.ResourceManager.Fluent-&gt;1.24.1,它将正常工作。请参阅此article

    【讨论】:

    • 我已经在引用同一个包的最新版本
    • 我已将项目类型从 .Net Framework 更改为 .Net Core 并引用了所有最新的 dll。它现在工作正常,没有任何问题。
    猜你喜欢
    • 2018-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    • 2020-11-25
    相关资源
    最近更新 更多