Hangfire failes to load assembly

喜夏-厌秋 提交于 2019-12-20 01:55:07

问题


Context

I have two application in place, one is my main enterprise application and in other I have hangfire (hangfire server, client and dashboard) hosted. My main application also use hangfire for some long task and executes them asynchronously. Both using the same DB for HF storage. And there is only one HF server.

Issue

I am getting the following errors intermittently -

"Can not change the state to 'Processing': target method was not found." OR

"Can not change the state to 'Enqueued': target method was not found."

with following details -

System.IO.FileNotFoundException

Could not load file or assembly 'MyApp.Hangfire, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

where MyApp.Hangfire is my hangfire application executing jobs. And I am sure that it is there, and even some successful jobs affirms it.

Please find the attached screenshot for more details.

Observation

The issue is not consistent, the job not always fails, sometimes it fails, re queued and get passed and sometimes when it is out of retries it even fails. As shown in screenshot


回答1:


I've stumbled upon the same issue a few days ago and decided it's worth adding it here.
Solution: added a reference to 'MyApp.Hangfire' in the dashboard web app.

Context was very similar or identical to yours:
-Hangfire server was running as a Windows service;
-Hangfire dashboard running on top of a ASP.NET MVC 5 app;
-jobs were actually running but dashboard kept displaying a FileNotFoundException;

Same problem was reported and solved in the same way by @reggieboyYEAH.
Details here: https://github.com/HangfireIO/Hangfire/issues/558



来源:https://stackoverflow.com/questions/35219144/hangfire-failes-to-load-assembly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!