각 작업마다 석영 작업 및 트리거가 거의 예정되어 있지 않으며 데이터베이스 저장소를 사용하여 작업 세부 정보를 저장하고 간단한 트리거를 사용합니다. 나는 Azure 다중 인스턴스를 사용하고있다. 작업이 올바르게 스케줄되었지만 트리거가 실행되지 않고 트리거 상태가 "오류"이며 일시적인 문제입니다. 타입 'Quartz.SchedulerException'의 첫 번째 예외가 발생의 Quartz.dll 형 'System.ArgumentException'의 첫 번째 예외가 발생의 Quartz.dll
석영 작업 예외
다음 난 예외를 참조 콘솔에서,
유형 'Quartz.SchedulerException'의 첫째 예외가 누구도 날이 문제를 해결하는 데 도움이 시겠어요
의 Quartz.dll
에서 발생? 감사합니다편집 :
임 서비스가 시작되면 다음과 같이 Isession를 엽니 다해서 Ninject를 사용하여 :
개인 무효 InitService()를 {
IKernel kernel = CreateKernel();
_intraClockAuctionService = kernel.Get<IIntraClockAuctionService>();
}
개인 IKernel CreateKernel() { var kernel = new StandardKernel(); 다음과 같이
kernel.Bind<ISessionFactory>().ToProvider<SessionFactoryBuilder>().InSingletonScope();
kernel.Bind<ISession>().ToMethod(context => context.Kernel.Get<ISessionFactory>().OpenSession())
.InCallScope();
kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>));
kernel.Bind<IJobFactory>().To<JobFactory>();
kernel.Bind<Func<Type, IJob>>().ToConstant(new Func<Type, IJob>(type => (IJob)kernel.Get(type)));
kernel.Bind<ISchedulerFactory>().ToConstant(new StdSchedulerFactory(GetQuartzProperties()));
kernel.Bind<MembershipProvider>().ToConstant(Membership.Providers["DefaultMembershipProvider"]);
kernel.Bind<IMembershipService>().To<AccountMembershipService>();}
와 나는 내 직업 클래스를 만들 :
[DisallowConcurrentExecution]
public class AuctionActivateJob : IJob
{
private readonly ISession _session;
private readonly IAuctionService _auctionService;
private readonly JobManager _jobManager;
private readonly List<IScheduler> _schedulers = new List<IScheduler>();
public AuctionActivateJob(ISession session, JobManager jobManager, IAuctionService auctionService)
{
Utils.LogUtils.LogEvent("inside AuctionActivateJob");
_session = session;
_auctionService = auctionService;
_jobManager = jobManager;
}
public void Execute(IJobExecutionContext context)
{
try
{
SessionTransaction.BeginTransation(_session);
var auctionId = (int)context.MergedJobDataMap["AuctionId"];
var auction = _auctionService.GetAuction(auctionId);
LogUtils.LogEvent(auction.AuctionId + "_Activation starts:" + DateTime.Now);
_auctionService.ActivationStart(auction.AuctionId);
LogUtils.LogEvent(auction.AuctionId + "_Activation ends:" + DateTime.Now);
SessionTransaction.CommitTrans(_session);
}
catch (Exception e)
{
LogUtils.LogException(e);
Email.GenerateServiceExceptionEmail(e);
if (_session.Transaction != null && _session.Transaction.IsActive)
{
_session.Transaction.Dispose();
}
}
}
}
}
와 내가 같이 작업을 추가하는 것이 일반적인 클래스가
공용 클래스 JobManager
{
private readonly IJobFactory _jobFactory;
private readonly ISchedulerFactory _schedulerFactory;
public JobManager(ISchedulerFactory schedulerFactory, IJobFactory jobFactory)
{
_schedulerFactory = schedulerFactory;
_jobFactory = jobFactory;
}
public IScheduler Add<T>(ITrigger trigger) where T : IJob
{
string name = trigger.Key.Name;
IScheduler scheduler = _schedulerFactory.GetScheduler();
try
{
scheduler.JobFactory = _jobFactory;
scheduler.Start();
var jobName = typeof (T).Name + "_" + name;
var jobDetail = new JobDetailImpl(jobName, typeof (T));
var isScheduled = scheduler.CheckExists(new JobKey(jobName));
Utils.LogUtils.LogEvent("isScheduled in quartz: " + isScheduled);
if (isScheduled)
return null;
scheduler.ScheduleJob(jobDetail, trigger);
}
catch (JobPersistenceException exception)
{
Utils.LogUtils.LogException(exception);
return null;
//do not do anything
}
catch (Exception ex)
{
Utils.LogUtils.LogException(ex);
return null;
}
return scheduler;
}
공용 클래스 AuctionManagementService : IAuctionManagementService { 개인 정적 판독 전용 타임 스팬 SchedulePoolingInterval = TimeSpan.FromSeconds (Convert.ToInt32 (ConfigurationManager.AppSettings [ "SchedulePoolingInter 브로"])) ;
private readonly string _appName = ConfigurationManager.AppSettings["AppName"];
private readonly Timer _eventTimer;
private readonly ISession _session;
private readonly IAuctionService _auctionService;
private readonly JobManager _jobManager;
private readonly List<IScheduler> _schedulers = new List<IScheduler>();
private readonly ISchedulerFactory _schedularFactory;
public AuctionManagementService(ISession session, JobManager jobManager, IAuctionService auctionService, ISchedulerFactory schedulerFactory)
{
try
{
_session = session;
_eventTimer = new Timer();
_eventTimer.Elapsed += Refresh;
_eventTimer.Interval = SchedulePoolingInterval.TotalMilliseconds;
_jobManager = jobManager;
_auctionService = auctionService;
_schedularFactory = schedulerFactory;
_schedulers.Add(_schedularFactory.GetScheduler());
}
catch (Exception ex)
{
LogUtils.LogEvent(ex.Message + ex.StackTrace);
Utils.Email.GenerateServiceExceptionEmail(ex);
}
}
태그를 선택할 때 나타나는 설명을 반드시 읽으십시오! – Charles
, 감사합니다 – xyz