【发布时间】:2020-07-11 00:18:07
【问题描述】:
Fluent.Azure 上的任何命令都会导致“找不到方法”异常。
System.MissingMethodException:找不到方法:'无效 Microsoft.Rest.TokenCredentials..ctor(Microsoft.Rest.ITokenProvider, System.String, System.String)'。
在网上查了一下,没有这样的构造函数: https://docs.microsoft.com/en-us/dotnet/api/microsoft.rest.tokencredentials.-ctor?view=azure-dotnet
我正在像这样创建 azure 对象,它似乎正在工作。
var azure = Microsoft.Azure.Management.Fluent.Azure
.Authenticate(credentials)
.WithDefaultSubscription()
;
但只要我尝试以下任一命令,就会出现此异常:
var l = await azure.VirtualMachines.ListAsync();
var webapp = azure.WebApps.GetByResourceGroup(resourceGroup, name);
我指的是 .NET 4.7.2 的 Microsoft.Azure.Management.Fluent 1.34.0 版。
它有这些依赖:
我的参考文献确实在这些范围内:
【问题讨论】: