Spring.Net定時器使用注意

[size=medium]在項目開始時,需要使用定時功能,在調試模式下,沒有任何問題,但是在部署到IIS後,定時器卻不執行,後來才發現,由於默認的配置文件中的對象,默認是延遲實例化的。後來通過設置對象的singleton="true" 。具體如下:
<object id="JobDetail" type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject,
Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="register" />
<property name="TargetMethod" value="DeleteUploadImages" />
</object>

<object id="CronTrigger" type="Spring.Scheduling.Quartz.CronTriggerObject, Spring.Scheduling.Quartz20">
<property name="JobDetail" ref="JobDetail"/>
<!--run every morning at 3 AM -->
<!--<property name="CronExpressionString" value="0 0 3 * * ?" />-->
<property name="CronExpressionString" value="0/20 * * * * ?"/>
</object>

<object id="quartzSchedulerFactory" type="Spring.Scheduling.Quartz.SchedulerFactoryObject,
Spring.Scheduling.Quartz20">
<property name="triggers">
<list>
<ref object="CronTrigger" />
</list>
</property>
<property name="AutoStartup" value="true"/>
</object>
<object id="register" type="~/User/Register.aspx" autowire="byName" [i][color=red]singleton="true"[/color] [/i]/>[/size]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章