使用 AzureStoragePersistence 的 NServiceBus 5 在开发机器以外的机器上导致 "Failed to fetch timeouts from the timeout storage"
NServiceBus 5 using AzureStoragePersistence results in "Failed to fetch timeouts from the timeout storage" on machines other then development machine
我尝试使用 Azure Table 存储来持久化超时数据,但我在本地开发机器以外的环境中遇到错误。
我的本地计算机正在 Azure 上创建超时表并且能够成功轮询超时数据。但是,如果我在另一台服务器上托管相同的软件,它无法获取超时。我收到以下错误:
2015-02-12 09:43:50,638 [10] WARN NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver - Failed to fetch timeouts from the timeout storage
System.NullReferenceException: Object reference not set to an instance of an object.
at NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver.Poll(Object obj) in c:\BuildAgent\workb05a2fea6e4cd32\src\NServiceBus.Core\Timeout\Hosting\Windows\TimeoutPersisterReceiver.cs:line 88
at System.Threading.Tasks.Task.Execute()
似乎 TimeoutPersister 在要从中获取数据时为 null。
我使用 NServiceBus.Host 托管 NServiceBus。我的端点配置如下所示:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
public void Customize(BusConfiguration configuration)
{
configuration.UsePersistence<AzureStoragePersistence>();
configuration.EndpointName("MyEndpoint");
configuration.UseTransport<RabbitMQTransport>()
.DisableCallbackReceiver();
configuration.DisableFeature<Sagas>();
configuration.ScaleOut().UseSingleBrokerQueue();();
}
}
我的 app.config 包含:
<connectionStrings>
<add name="NServiceBus/Transport" connectionString="host=myrabbitmqserver;virtualhost=myhost;username=me;password=secret" />
</connectionStrings>
<AzureTimeoutPersisterConfig ConnectionString="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=myaccouuntkey;" TimeoutManagerDataTableName="TimeoutManager" TimeoutDataTableName="TimeoutData" />
有谁知道我做错了什么,或者有人能指出我正确的方向来调查问题所在吗?
更新 1
NServiceBus.Azure 程序集似乎没有加载到其他机器上。因此,在使用 TimeoutPersister 时,未初始化 azure 持久性功能会导致 NullReferenceException。
更新 2 经过一些 NServiceBus 调试后,我注意到从 NServiceBus.Azure.dll 程序集中提取类型时抛出了异常。无法加载引用的程序集 Miscrosoft.Data.Services.Client.dll 5.6.0.0。这个程序集确实不在 bin 文件夹中。当前版本为 5.6.3.0。 NServiceBus.Azure NuGet 包支持 >= 5.6.0.0 < 6.0.0.0 的版本,但不知何故它仍然期待版本 5.6.0.0。它在我的开发机器上工作仍然感觉很奇怪?也许我的机器上安装了一些旧版本的 Microsoft.Data.Services.Client.dll 作为 Azure SDK 的一部分,它们是在程序集加载过程中发现的。
更新 3
我的系统中确实有可用的旧 5.6.0 版本。将 Microsoft.Data.xxx 软件包降级到版本 5.6.0 暂时解决了这个问题。有没有人在使用 5.6.3 版本时遇到同样的问题并找到了解决方案?
更新 4
自 2015 年 2 月 13 日以来,发布了 NServiceBus.Azure 的新版本,现在它需要 Microsoft.Data.Services.Client 版本 5.6.2.0。我仍然无法使用 5.6.3 版本。添加程序集绑定重定向也无济于事。
它应该适用于 5.6.3 版本。尝试按以下方式添加 assembly bindingRedirect:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
必须将绑定重定向添加到 NServiceBus.Host.exe.config 而不是 app.config。非常烦人,因为 visual studio 会自动更新 app.config。
来自伊夫·戈列文的信息:
原因是 CLR 的默认加载行为是在进程级别,其中包括主机配置,一旦加载主机,我们就会主动切换到应用程序域级别(使用 topshelf),从那时起它使用端点的配置......
但是如果 CLR 需要在切换到应用程序域之前解析引用,则您必须将重定向放在主机级别(我猜是在端点级别)
我尝试使用 Azure Table 存储来持久化超时数据,但我在本地开发机器以外的环境中遇到错误。
我的本地计算机正在 Azure 上创建超时表并且能够成功轮询超时数据。但是,如果我在另一台服务器上托管相同的软件,它无法获取超时。我收到以下错误:
2015-02-12 09:43:50,638 [10] WARN NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver - Failed to fetch timeouts from the timeout storage
System.NullReferenceException: Object reference not set to an instance of an object.
at NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver.Poll(Object obj) in c:\BuildAgent\workb05a2fea6e4cd32\src\NServiceBus.Core\Timeout\Hosting\Windows\TimeoutPersisterReceiver.cs:line 88
at System.Threading.Tasks.Task.Execute()
似乎 TimeoutPersister 在要从中获取数据时为 null。
我使用 NServiceBus.Host 托管 NServiceBus。我的端点配置如下所示:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
public void Customize(BusConfiguration configuration)
{
configuration.UsePersistence<AzureStoragePersistence>();
configuration.EndpointName("MyEndpoint");
configuration.UseTransport<RabbitMQTransport>()
.DisableCallbackReceiver();
configuration.DisableFeature<Sagas>();
configuration.ScaleOut().UseSingleBrokerQueue();();
}
}
我的 app.config 包含:
<connectionStrings>
<add name="NServiceBus/Transport" connectionString="host=myrabbitmqserver;virtualhost=myhost;username=me;password=secret" />
</connectionStrings>
<AzureTimeoutPersisterConfig ConnectionString="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=myaccouuntkey;" TimeoutManagerDataTableName="TimeoutManager" TimeoutDataTableName="TimeoutData" />
有谁知道我做错了什么,或者有人能指出我正确的方向来调查问题所在吗?
更新 1 NServiceBus.Azure 程序集似乎没有加载到其他机器上。因此,在使用 TimeoutPersister 时,未初始化 azure 持久性功能会导致 NullReferenceException。
更新 2 经过一些 NServiceBus 调试后,我注意到从 NServiceBus.Azure.dll 程序集中提取类型时抛出了异常。无法加载引用的程序集 Miscrosoft.Data.Services.Client.dll 5.6.0.0。这个程序集确实不在 bin 文件夹中。当前版本为 5.6.3.0。 NServiceBus.Azure NuGet 包支持 >= 5.6.0.0 < 6.0.0.0 的版本,但不知何故它仍然期待版本 5.6.0.0。它在我的开发机器上工作仍然感觉很奇怪?也许我的机器上安装了一些旧版本的 Microsoft.Data.Services.Client.dll 作为 Azure SDK 的一部分,它们是在程序集加载过程中发现的。
更新 3 我的系统中确实有可用的旧 5.6.0 版本。将 Microsoft.Data.xxx 软件包降级到版本 5.6.0 暂时解决了这个问题。有没有人在使用 5.6.3 版本时遇到同样的问题并找到了解决方案?
更新 4 自 2015 年 2 月 13 日以来,发布了 NServiceBus.Azure 的新版本,现在它需要 Microsoft.Data.Services.Client 版本 5.6.2.0。我仍然无法使用 5.6.3 版本。添加程序集绑定重定向也无济于事。
它应该适用于 5.6.3 版本。尝试按以下方式添加 assembly bindingRedirect:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
必须将绑定重定向添加到 NServiceBus.Host.exe.config 而不是 app.config。非常烦人,因为 visual studio 会自动更新 app.config。
来自伊夫·戈列文的信息: 原因是 CLR 的默认加载行为是在进程级别,其中包括主机配置,一旦加载主机,我们就会主动切换到应用程序域级别(使用 topshelf),从那时起它使用端点的配置......
但是如果 CLR 需要在切换到应用程序域之前解析引用,则您必须将重定向放在主机级别(我猜是在端点级别)