Closed priyanka945 closed 4 months ago
@priyanka945, looks strange.
try to drop the hangfire collections.
since you are using
settings.ServerApi = new ServerApi(ServerApiVersion.V1);
you should set option
SupportsCappedCollection = false
using the stable API needs this option as it else will try to create a capped collection
I hope this helps
@priyanka945,
Did you have any progress on this?
Thanks
closing due to inactivity
Hi,
I am trying to integrate Hangfire to mongodb in my .net 6 web api application. The mongo db has some application related collections and after integrating with hangfire library , running this locally pointing to the database: it created below hang_fire collection in the db specified. And on the localhost the app is up and running.
Package referenced: "Hangfire" Version="1.8.10" "Hangfire.Mongo" Version="1.10.3" "MongoDB.Driver" Version="2.24.0" "Hangfire.Console" Version="1.4.3" "Hangfire.Dashboard.Basic.Authentication" Version="5.0.0"
But when the app is deployed to Host(PCF), it started returning error as below:
Code:
Program.cs: builder.Services.ConfigureHangfireService(configuration);
Note : When the app is getting deployed to host (PCF) 'Hang_fire.migrationLock' collection already exist in the db it is pointing to. Error Log:
Approach2: As suggested above manually dropped collection: 'Hang_fire.migrationLock' in db, kept rest of the Hang_fire collections and started app again in host still the same error.
Approach3: Dropped all the hangfire related collections and gave the new Prefix "Hangfire_mongo" in MongoStorageOptions, started the app on host. Still the same error, but now it has only created 'Hangfire_mongo.migrationLock' collection and rest of the hangfire related collections are not created and the app fails to start with following error:
Is it looking for deleted 'Hang_fire.migrationLock' collection?
Note1 : Increased MigrationLockTimeout till 5minutes, still the same error. And connection from Host to Mongo db seems fine as its able to create collection Hangfire_mongo.migrationLock and issue occurrs only when app starts in Host.
Any pointer on how to resolve this isssue would be helpful.