c# - Quartz is not working in real server -
i have access db , ftp live server. want schedule task. did schedule in quartz.net (asp.net c#) , it's working fine in local server, when upload server no out put. added file write command top , bottom of task, files writing destination. here code wrote
public partial class saaitest : system.web.ui.page { protected void page_load(object sender, eventargs e) { testclass t = new testclass(); t.method("start"); ischedulerfactory factory = new stdschedulerfactory(); ischeduler scheduler = factory.getscheduler(); ijobdetail job = jobbuilder.create<testclass>() .withidentity("name", "group") .build(); itrigger triggercron = triggerbuilder.create() .withcronschedule("0 0/1 * 1/1 * ? *") .startnow() .build(); scheduler.schedulejob(job, triggercron); scheduler.start(); thread.sleep(timespan.fromminutes(10)); scheduler.shutdown(); t.method("stop"); } } public class testclass : ijob { public void execute(ijobexecutioncontext context) { this.method("job"); } public void method(string filename) { streamwriter file2 = new streamwriter(hostingenvironment.mappath("~\\test\\" + filename + ".txt"), true); file2.writeline("write time : " + datetime.now); file2.close(); } }
i started schedule running page, tried adding global.asax
. should start scheduler in live server, possible stop schedule server, if solution ?
i hope link give need simulate windows service using asp.net run scheduled jobs
quartz uses windows services, use hangfire instead doesn't need windows services. hangfire, must adding background tasks in asp.net link started
Comments
Post a Comment