Quartz.Net调度程序服务在启动时不会自动启动

时间:2015-02-23 11:45:46

标签: c# sql-server sockets windows-services quartz.net

我开发了一个 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服务后,我们为其提供一个用户名,该用户名可以访问服务的登录选项卡中的目标数据库。我们将服务设置为自动启动(并且还尝试了自动延迟模式)。在服务的 Recovery 选项卡中,如果崩溃,我们还会将其命令为重新启动

然而,这项服务似乎并没有在某些机器上自动启动,这让我想了很长一段时间。在出现故障的计算机上,这是我的服务在无法启动时记录的内容:

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服务专家提供的任何帮助。

1 个答案:

答案 0 :(得分:1)

声明。我不是Quartz.net开发团队的成员,也不是Windows服务方面的专家

  

该服务安装在主机127.0.0.1端口555上,似乎不需要依赖项,因为它可以在其他一些机器上运行。

你的推理是错误的。可能只是发生所需的服务总是在其他机器上启动,但是没有设置依赖性,这是不可保证的。

因此,由于您收到DNS错误,我建议您首先设置服务,这取决于 Dnscache Tcpip