サービスとしてインストールされた Quartz.net 2.2 を使用しています。ジョブは、AdoJobStore を使用して ms sql Express に格納されます。ジョブは、asp.net 4 Web サイトから管理されます。期待どおり、すべてが正常に機能します。サービスは実行されており、ジョブは正しく保存およびトリガーされています。私が直面している問題は、毎日午前 7 時以降 (これはアプリケーション プールがリサイクルされるときです)、サイトにアクセスすると、次のエラーが発生することです。
オブジェクト '/QuartzScheduler' が切断されたか、サーバーに存在しません。
[RemotingException: オブジェクト '/QuartzScheduler' が切断されたか、サーバーに存在しません。 PrivateInvoke(MessageData& msgData, Int32 type) +345 Quartz.Simpl.IRemotableQuartzScheduler.get_SchedulerName() +0 Quartz.Impl.RemoteScheduler.b__6(IRemotableQuartzScheduler x) +8 Quartz.Impl.RemoteScheduler.CallInGuard(Func`2 func) +61
[SchedulerException: リモート スケジューラとの通信エラー] Quartz.Impl.RemoteScheduler.CallInGuard(Func`2 func) +100 Quartz.Impl.RemoteScheduler.get_SchedulerName() +92 Quartz.Impl.SchedulerRepository.Bind(IScheduler sched) +65 Quartz .Impl.StdSchedulerFactory.Instantiate() +1815 Quartz.Impl.StdSchedulerFactory.GetScheduler() +102 ASP.global_asax.Application_Start(オブジェクト送信者、EventArgs e) +241
[HttpException (0x80004005): リモート スケジューラとの通信エラー] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext コンテキスト、HttpApplication アプリ) +9189101 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext、HttpContext コンテキスト、MethodInfo[] ハンドラー) +131 System.Web.HttpApplication.InitSpecial(HttpApplicationState 状態、MethodInfo[] ハンドラー、IntPtr appContext、HttpContext コンテキスト) +194 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext、HttpContext コンテキスト) +339 System.Web.Hosting.PipelineRuntime.InitializeApplication( IntPtr appContext) +253
[HttpException (0x80004005): リモート スケジューラとの通信エラー] System.Web.HttpRuntime.FirstRequestInit(HttpContext コンテキスト) +9104200 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext コンテキスト) +97 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext コンテキスト) +256
この後、サーバーにアクセスして Quartz.net サービスを停止/開始すると、サイトは正しく開始されます。
FTP経由で変更されたweb.config、または変更された別のファイルをアップロードしてWebサイトを再起動するたびに、同じことが発生します。ここで同じエラーが発生しますが、Quartz.net サービスの停止と再起動を回避できます。
Web サイトのglobal.asaxは次のとおりです。
public static ISchedulerFactory SchedulerFactory;
public static IScheduler Scheduler;
void Application_Start(object sender, EventArgs e)
{
NameValueCollection p = new NameValueCollection();
p["quartz.scheduler.instanceName"] = "MyScheduler";
p["quartz.scheduler.proxy"] = "true";
p["quartz.threadPool.threadCount"] = "0";
p["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";
SchedulerFactory = new StdSchedulerFactory(p);
Scheduler = SchedulerFactory.GetScheduler(); // <-- The exception seems to occur here
if (!Scheduler.IsStarted)
Scheduler.Start();
}
void Application_End(object sender, EventArgs e)
{
Scheduler.Shutdown(true);
}