When using middleware hangfire server I got an exception from hangfire.pro.redis.dll

Tags: #<Tag:0x00007efd2850fbf0>

I target .NET CORE 2.2, hangfire.pro.redis 2.2.1, hangfire.pro 1.7.14
I got this exception when the runtine trying to add middleware hangfireServer :

System.MissingMethodException: Method not found: ‘StackExchange.Redis.ConnectionMultiplexer StackExchange.Redis.IRedisAsync.get_Multiplexer()’. at Hangfire.Pro.Redis.RedisStorage.GetMasterEndpoint() at Hangfire.Pro.Redis.RedisStorage.ToString() at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args) at Hangfire.BackgroundJobServer…ctor(BackgroundJobServerOptions options, JobStorage storage, IEnumerable 1 additionalProcesses, IJobFilterProvider filterProvider, JobActivator activator, IBackgroundJobFactory factory, IBackgroundJobPerformer performer, IBackgroundJobStateChanger stateChanger) at Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder app, BackgroundJobServerOptions options, IEnumerable 1 additionalProcesses, JobStorage storage) at UlysOpusApi.Configuration.Hangfire.HangfireMiddlewareConfiguration.UseHangfire(IApplicationBuilder app, HangfireConfiguration configuration) in C:\Work\interface_opus_digital\UlysOpusApi\Main\4_Infrastructure\UlysOpusApi.Configuration\HangFire\HangfireMiddlewareConfiguration.cs:line 17 at UlysOpusApi.Web.Startup.Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime, IHostingEnvironment env, ILogger logger, IHangfireService hangfireService, IOptions 1 swaggerConfiguration, IOptions 1 hangfireConfiguration) in C:\Work\interface_opus_digital\UlysOpusApi\Main\1_DistributedInterfaceLayer\UlysOpusApi.Web\Startup.cs:line 95 — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass2_0.b__0(IApplicationBuilder app) at Microsoft.Extensions.DependencyInjection.AutoRegisterMiddleware.<>c__DisplayClass4_0.b__0(IApplicationBuilder app) in E:\BA\56\s\src\Microsoft.AspNetCore.Mvc.Versioning\Microsoft.Extensions.DependencyInjection\AutoRegisterMiddleware.cs:line 46 at Microsoft.AspNetCore.Mvc.Internal.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder) at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.b__0(IApplicationBuilder app) at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Hangfire.Pro.Redis 2.2.1 uses non-internalised version of StackExchange.Redis package in .NET Core. Ensure your distribution contains StackExchange.Redis package and ensure its version is 1.2.6, other versions may be not support for that Hangfire.Pro.Redis version.

indeed my distribution contains StackExchange.Redis package version 1.2.6. But I don’t understand why when I add UseRedistorage function to hangfire, at the runtime middleware raise an exception :
Exception thrown: ‘System.MissingMethodException’ in Hangfire.Pro.Redis.dll
An exception of type ‘System.MissingMethodException’ occurred in Hangfire.Pro.Redis.dll but was not handled in user code
Method not found: ‘StackExchange.Redis.ConnectionMultiplexer StackExchange.Redis.IRedisAsync.get_Multiplexer()’.

Something strange is happening with that StackExchange.Redis assembly, since it shouldn’t cause any errors, since IRedisAsync.Multiplexer (accessed via IDatabase -> IDatabaseAsync -> IRedisAsync all chain) property should exist there unless it’s manually changed and compiled. Could you send your StackExchange.Redis.dll file to me for analysis?

Actually StackExchange.Redis binaries are merged and internalised since version 2.4.0 to avoid any possible issues, including this. Contact us support (at) hangfire.io and tell your company name to see what versions are available for you.

this is my StackExchange.Redis.dll file : https://1drv.ms/u/s!AuB6OET5hHLNgcVD9Pno70QGNyTGgQ?e=HqwxQH

I solved this issue, I had a project that referenced the aspnetcore.healthChecks.redis package version 2.2.4 but this package included StackExchange.Redis.dll version 2.0.513, that’s why this exception whas happening

1 Like