I am trying to set up hangfire running as a windows service as described here: http://docs.hangfire.io/en/latest/background-processing/processing-jobs-in-windows-service.html
The code won’t compile as is because of the readonly on the _service variable. If I remove that I can set everything up, get a windows service running but my hangfire server never shows up in the Servers tab of the hangfire dashboard.
If I follow the example for a console application it works right away. Does anyone have a working code sample of a simple hangfire service?
More info: I’m using sql server for storage, using a profiler I can see that when I launch the console application the Hangfire script for updating schema runs and then a whole bunch of transactions are run including one that begins with merge HangFire.Server with (holdlock) and appears to register the server.
If I start the windows service on the same database I see the schema script starting and finishing but nothing happens after that.
Could this be related to permissions ? (Is a Windows user used to access SQL Server ?) Have you tried attaching a logger ?
It was permission related, attaching the logger was a good call, thanks for the help.
I changed the readonly and it worked and it shows in my servers. Not sure but there’s probably something else that’s going on outside of that.