hangfire-postgres / Hangfire.PostgreSql

PostgreSql Storage Provider for Hangfire
Other
358 stars 132 forks source link

NpgsqlConnectionFactory Throw ArgumentNullException("connectionString") #340

Closed Majed-404 closed 8 months ago

Majed-404 commented 8 months ago

i have a problem with hangfire i have one project for WebAPI using .NET 8 and PostgreSql For DB when i run the 2 projects i got error in class NpgsqlConnectionFactory image

here is how i configure Hangfire

services.AddHangfire((provider, configuration) => configuration .UseFilter(new CustomAutomaticRetryAttribute()) .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) .UseSimpleAssemblyNameTypeSerializer() .UseRecommendedSerializerSettings() .UseLogProvider(new CustomHangfireLogProvider())

if DEBUG

            .UseMemoryStorage()

endif

if !DEBUG

            .UsePostgreSqlStorage(c => c.UseNpgsqlConnection(AppSettings.ConnectionString))

endif

            .UseMediatR());

if DEBUG

        services.AddHangfireServer();

endif

and this is the packages that i have installed

azygis commented 8 months ago

Not really something that can be wrong in the library. Check how and when AppSettings.ConnectionString is configured. Exception is saying it is null at the time of calling the UsePostgreSqlStorage().