Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I made a windows service that monitors a table of pirticluar db and triggers a mail to user on a condition. The service is working absolutely fine for 2,3 days but after that its not triggering any mail. The service is staying in running state and also there is no exception logged in event viewer on this service name and its not triggering any mails. If i restart the service its again working fine.

Can anyone help me here pls.....
Posted

Check that you are correctly disposing all of your objects - it sounds like some resource (such as SqlCommand, SQlConnection etc.) is not being released properly. If this does not cause memory problems (and it won't, they don't take a lot of space) then the GC is not kicked in to call Dispose to free up the object resources and new ones can't be created until they are. It may not be just Sql objects - but I don't know what others you use.
 
Share this answer
 
Comments
charles henington 7-Apr-12 0:08am    
my 5
try checking that the timer being used hasnt been disposed and that the timer is enabled
C#
protected void checkTimer(Timer t)
{
if (t == null)
{
t = new Timer();
t.Enabled = true;
}
else
{
if (!t.Enabled)
{
t.Enabled = true;
}
else
{
// check the Griffs post on properly disposing objects.
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900