我正在使用新近推出的 NServiceBus 功能,该功能支持 DataBus 的 Azure Managed Service Identities。我的实现是非常普通的,除了为 AzureDataBus 启用 MSIs 之外,没有任何配置。然而,当 NServiceBus 去更新我的令牌时,我在日志中得到了这样的输出。
Unhandled exception. System.InvalidCastException: Unable to cast object of type 'Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider' to type 'System.ValueTuple`2[Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider,NServiceBus.DataBus.AzureBlobStorage.DataBusSettings]'.
at NServiceBus.DataBus.AzureBlobStorage.AzureDataBusPersistence.TokenRenewerAsync(Object state, CancellationToken token)
at Microsoft.WindowsAzure.Storage.Auth.TokenCredential.RenewTokenAsync(Object state)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
配置如下
var dataBus = endpointConfiguration.UseDataBus<AzureDataBus>();
dataBus.AuthenticateWithManagedIdentity(accountName, TimeSpan.FromMinutes(1));
我还没有找到任何与此相关的东西。我接下来可以尝试什么?
这似乎是 NServiceBus 如何配置其 TokenCredential 以进行更新的一个错误。我已经向他们提交了一个支持票据来调查。
修复的PR。https:/github.comParticularNServiceBus.DataBus.AzureBlobStoragepull112。
当TokenCredential被实例化时,它是一个提供的状态,与令牌更新器的预期状态不匹配。