Hi,
I am getting the following error when I try to start the windows service I have written:
ReadOutlookServ ice on local computer started and then stopped.Some services stop automatically if they have no work to do, for example the Performance logs and alerts service.
My Service.cs contains the following:
How do I debug the service ? The service gets installed, but I am not able to run it, since it starts and stops immediately.
Thanks in advance,
mrk
I am getting the following error when I try to start the windows service I have written:
ReadOutlookServ ice on local computer started and then stopped.Some services stop automatically if they have no work to do, for example the Performance logs and alerts service.
My Service.cs contains the following:
Code:
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
eventLog1.WriteEntry("ReadOutLookService OnStart");
tm.Enabled = true;
//tm.Start;
tm.Elapsed += new ElapsedEventHandler(Timer_Elapsed);
}
protected void Timer_Elapsed(object sender,
System.Timers.ElapsedEventArgs e)
{
try
{
//eventLog1.WriteEntry("Timer started");
_Application olApp = new ApplicationClass();
_NameSpace olNs = olApp.GetNamespace("MAPI");
MAPIFolder oInbox = olNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
Items oItems = oInbox.Items;
for (int i = 1; i <= oItems.Count; i++)
{
_MailItem oMail = (_MailItem)oItems.Find("DTE Time Reminder");
oMail.Display(false);
}
}
catch (System.Exception ex)
{
throw (ex);
}
}
Thanks in advance,
mrk
Comment