简体   繁体   中英

Using Quartz .net in windows Service

I have been trying to recreate a .net Windows Service to utilize the Quart Scheduling system, instead of simple timers. So far the Service runs perfectly when started from inside a separate GUI app that has been built to run the service in an interactive mode. However when starting the service alone from within Service manager I receive a windows service error 1053 immediately after starting it (most of the time, it has started a few times on one computer but very inconsistently and even then only after a reboot). After attaching a debugger to the process I can see that it always stops when running “GetScheduler()” (the program never throws an exception however)

Currently I am creating a Schedule factory and running GetScheduler() from within the service constructor. I have tried running these commands in the OnStart() method instead but I receive an error 1067 then.

Also because Quart is open source, I have tried importing its code and searching for where my program stops inside of GetScheduler() but it never stops at the same place.

Any ideas for why I can't run the program as a service would be appreciated, Thanks

Try this:

1) Download the entire project from github ( https://github.com/quartznet/quartznet )

2) Use the Server folder contents as your starting point

3) Use topshelf install commands ( How can I automate a Topshelf interactive service install? ). Validate by finding the Quartz.Service running in the services console (services.msc)

4) Out of the box it comes with one job (SampleJob.cs) make this your first job and customize from there.

hope this helps.

Have you created a quartz.config file in the same path where the executable being called by your service is? If yes, look if it is properly configured, take a look on these references:

Something else that could be happening is if you are storing jobs and triggers in a database, your service have to be installed using an appropriate Account that has the needed permissions to access your system database. If it is the problem, you need to create a installer for your service and configure it to prompt a username and password during installation. ( https://msdn.microsoft.com/en-us/library/0x72fzyf(v=vs.110).aspx )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM