Windows service and Timers ???
dear all,
I have build a windows service hosting a remote component object call
through a client applciation using TCP.
The remote componenent is filling incoming data to a SQL buffer table.
then I have define on my service side a timer object which is executed evry
5 seconds ad pool for new incoming data into this buffer. If it founds some
then it call a function from an other assemblies which is calling a
parameterized store procedure.
Doing this process from a test application by starting the poling mnually
with a button works greats.
But when running on timer based inside my service, it sounds that teh
function is not completly executed, few lines in the calling function gets
executed but not the others. I have log this to file to notify this.
I have used my timer event as follow :
protected override void OnStart(string[] args)
{
// Configure remoting object attribute
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, true);
// Configure current event history management
m_tPool = new System.Timers.Timer(5000);
m_tPool.Enabled = true;
// Hook up the Elapsed event for the timer.
m_tPool.Elapsed += new ElapsedEventHandler(OnTimedEvent);
GetConnectionFromConfigFile();
m_Hist = new
Maillefer.EventManager.History.EventHistory(m_SqlConfig, m_SqlConRuntime);
m_tPool.Start();
}
// event called on timer tick
private void OnTimedEvent(object sender, ElapsedEventArgs e)
{
sw.WriteLine("Timer ticket:" +DateTime.Now);
sw.Flush();
m_Hist.UpdateHistory();
}
Is there any issue with timers inside a service ?
Why my store procedure is not executed when call as shoen above ?
Thnask for help
regards
serge
Date:Fri, 15 Jun 2007 08:21:01 -0700
Author:
|