Is there any way to gain access to the HttpContext object from a Quartz.NET job? HttpContext.Current and the likes do not seem to work with Quartz.NET jobs.
相关问题
- How to configure quartz scheduler with spring-styl
- How to override quartz's property value
- MYSQL 5.5 Drop Primary Key
- JBoss 7.1.1 and the EJB 3.1 Timer Service
- Quartz.Net cron trigger to schedule a job every 45
相关文章
- quartz.net 如何实现动态job ,appdomain 域卸载问题
- quartz.net 执行时,并发执行了多次
- Quartz vs Java EE 7 scheduler
- Grails and Quartz: Bad value for type long
- Dynamically scheduling jobs: using cron trigger in
- use verify on mocked (with Mockito) objects inject
- Recover from trigger ERROR state after Job constru
- Scheduled processes running twice simultaneously i
In short, no.
Jobs are ran on different threads that do not know about a HTTP request that has happened at some point. The job might run after the request was processed and thus the context would be invalid anyway.
With frameworks like ASP.NET MVC you can do some things without actual context, like generating route urls etc but request and response (pretty much the context) are not available.
You need to partition the responsibilities so that Quartz jobs can work autonomously.
Yes there is a way.
Just set HttpContext.Current to JobDataMap when instantiating new scheduler(probably in Application_Start event in Global.asax) like this:
Then access it in Execute method like this: