# Problem with Delayed Job - I am in big trouble

**URL:** <https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422>\
**Category:** bug?\
**Created:** [December 3, 2014, 11:11am UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422 "2014-12-03T11:11:54Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![kkchan](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@kkchan](https://discuss.hangfire.io/u/kkchan)\
**Post date:** [February 25, 2015, 1:09pm UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/21 "2015-02-25T13:09:57Z")

</div>

Hi  
From dashboard, it shown exception “Can not find the target method.”. for schedule()

However, it I use enqueue, it is working perfectly.

> var jobid = BackgroundJob.Enqueue(() =\> WriteX(“GGG”,  
> DerivedHangfireToken.Null));

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [February 25, 2015, 2:33pm UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/22 "2015-02-25T14:33:28Z")

</div>

Are you using separate application (console, windows service) for processing background jobs or have multiple applications using the same database?

---

<div class="post-metadata">

**Author:** ![kkchan](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@kkchan](https://discuss.hangfire.io/u/kkchan)\
**Post date:** [February 26, 2015, 2:22am UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/23 "2015-02-26T02:22:10Z")

</div>

Hi  
I have tried this out in 2 environments, Console, and also Unit Testing.  
Both doesn’t work.  
And Yes, both shared the same database, however, neither the job scheduled in Console nor Unit Testing are working.

Please advice. thank you

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [February 26, 2015, 10:12am UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/24 "2015-02-26T10:12:50Z")

</div>

Can you enumerate all of your applications and instances using Hangfire with shared database in the following way:

**Front-end Web Application**  
_Has a reference to assembly that contains `WriteX` method_: Yes  
_Creates Background Jobs_: Yes  
_Runs Hangfire Server_: No

**Back-end Web Application**  
_Has a reference to assembly that contains `WriteX` method_: No  
_Creates Background Jobs_: No  
_Runs Hangfire Server_: Yes

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [February 26, 2015, 10:13am UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/25 "2015-02-26T10:13:53Z")

</div>

The problem is likely related to a missing assembly reference ensure all your applications have a reference to assembly that contains `WriteX` method.

---

<div class="post-metadata">

**Author:** ![kkchan](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@kkchan](https://discuss.hangfire.io/u/kkchan)\
**Post date:** [February 27, 2015, 4:18am UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/26 "2015-02-27T04:18:41Z")

</div>

Hi  
After more testing, I found the exception only happen in below scenario,  
In my unit testing,

1. Start Server
2. EnqueueJob
3. Assert.IsTrue(ManualResetEvent.WaitOne(2000)) which will be set in my method.
4. Stop Server

The problem here is, as I posted in another thread, SQL Server poll interval is 10 seconds. Before I know about this, I only wait for 2 secs, then will stop the server.

It seem like, if enqueued job not executed and server stopped, program would hit exception as posted above. I even hit some other weird exception either.

After I changed my code to wait more than 10 secs, everything back to normal.  
So, my concern is, if that is any pending enqueued Job, and server stopped. Would it throw exception?

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [July 24, 2015, 3:16pm UTC](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422/27 "2015-07-24T15:16:17Z")

</div>



[Previous page](https://discuss.hangfire.io/t/problem-with-delayed-job-i-am-in-big-trouble/422.md?page=1)
