簡體   English   中英

Quartz.Net Scheduler服務不會在啟動時自動啟動

[英]Quartz.Net scheduler service does not start automatically on startup

我已經開發了Quartz.Net Windows服務來運行計划的作業,並且我已經設置了SQLite作業存儲來使其工作。 這是我的AdoJobStore的設置:

# SQLite settings
quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.misfireThreshold = 60000
quartz.jobStore.lockHandler.type = Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz
quartz.jobStore.useProperties = true
quartz.jobStore.dataSource = default
quartz.jobStore.tablePrefix = qrtz_
quartz.jobStore.driverDelegateType = Quartz.Impl.AdoJobStore.SQLiteDelegate, Quartz
quartz.dataSource.default.provider = SQLite-10
quartz.dataSource.default.connectionString = Data Source=.\jobs.db;Version=3

在讓您頭痛之前,我應該說這是一個可行的解決方案! 這意味着工作商店就可以了! 每個作業都包含運行一個.exe文件,該文件將使用存儲在文本文件中的連接字符串從SQL Server數據庫中獲取其參數。

因此,如果該服務自動啟動,則一切正常。

安裝Windows服務后,我們在服務的“ 登錄”選項卡中為其提供一個可以訪問目標數據庫的用戶名。 我們將服務設置為自動啟動(並嘗試了“ 自動延遲”模式)。 在服務的“ 恢復”選項卡中,我們還命令它在崩潰時重新啟動

但是,該服務似乎並不是在某些機器上單獨啟動的,這讓我想了很長時間。 在發生故障的計算機上,這是我的服務啟動失敗時記錄的內容:

2015-02-13 15:09:15,674 [1] ERROR Quartz.Server.QuartzServer [(null)] - Server initialization failed:Unable to bind scheduler to remoting.
Quartz.SchedulerException: Unable to bind scheduler to remoting. ---> System.Net.Sockets.SocketException: No such host is known
   at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
   at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
   at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
   at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupMachineName()
   at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
   at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
   at Quartz.Simpl.RemotingSchedulerExporter.RegisterRemotingChannelIfNeeded()
   at Quartz.Simpl.RemotingSchedulerExporter.Bind(IRemotableQuartzScheduler scheduler)
   at Quartz.Core.QuartzScheduler.Bind()
   at Quartz.Core.QuartzScheduler.Initialize()
   --- End of inner exception stack trace ---
   at Quartz.Core.QuartzScheduler.Initialize()
   at Quartz.Impl.StdSchedulerFactory.Instantiate()
   at Quartz.Impl.StdSchedulerFactory.GetScheduler()
   at Quartz.Server.QuartzServer.Initialize() [See nested exception: System.Net.Sockets.SocketException (0x80004005): No such host is known
   at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
   at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
   at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
   at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupMachineName()
   at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
   at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
   at Quartz.Simpl.RemotingSchedulerExporter.RegisterRemotingChannelIfNeeded()
   at Quartz.Simpl.RemotingSchedulerExporter.Bind(IRemotableQuartzScheduler scheduler)
   at Quartz.Core.QuartzScheduler.Bind()
   at Quartz.Core.QuartzScheduler.Initialize()]

該服務安裝在主機127.0.0.1端口555 ,並且似乎不需要依賴,因為它在某些其他計算機上也可以運行。

我有一種感覺,該服務在嘗試訪問數據庫或建立TCP主機之前嘗試啟動自身。 但是,如果是這樣,為什么它可以在其他設備上運行?

我之前曾問過同樣的問題,但沒有找到有效的答案。 非常感謝Quartz.Net開發團隊或Windows服務專家的任何幫助。

免責聲明。 我不是Quartz.net開發團隊的成員,也不是Windows服務的專家

該服務安裝在主機127.0.0.1端口555上,並且似乎不需要依賴,因為它在某些其他計算機上也可以運行。

您的推論是錯誤的。 這可能是因為所需的服務恰好一直開始在其他機器,但沒有設置這個不能保證的依賴。

因此,由於您遇到了DNS錯誤,因此建議您首先將服務設置為取決於DnscacheTcpip

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM