asp.net web api - Hangfire, Autofac and WebApi -


i learned hangfire had no luck far. project uses autofac i've added hangfire.1.4.3 & hangfire.autofac.1.1.0 nuget packages project. followed documentation i've created startup class , registered hangfire there

public void configuration(iappbuilder app) {       globalconfiguration.configuration                     .usesqlserverstorage("navigatorconnectionstring");         app.usehangfiredashboard();        app.usehangfireserver(); } 

after i've updated webapiconfig , registered autofac container in hangfire

private static void registerdependencies(httpconfiguration config) {      var builder = new containerbuilder();      ...      var container = builder.build();      ...      config.dependencyresolver = new autofacwebapidependencyresolver(container);      hangfire.globalconfiguration.configuration.useautofacactivator(container); } 

when try run hangfire job like

iobject someobject = myobject();     var jobid = backgroundjob.enqueue<imyinterface>(x                     => x.mymethod(someobject)); 

i following error

system.invalidoperationexception type mynamespace.imyinterface not contain method signature mymethod(iobject1)` @ hangfire.storage.invocationdata.deserialize() can issue?

the issue in hangfire way of work. serializes parameters , in case of generics can't desirialize back. workaround create mediator can serialized/desirialized , run code need.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -