Windows Develop Bookmark and Share   
 index > Windows Forms General > windows service timmer fired problem
 

windows service timmer fired problem

this is my widows service. the problem is the timer not fired in this service when i debug....


Public Class Service1
#Region "variables"
Private t As Timers.Timer
#End Region


Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
t = New Timers.Timer(1000)
t.AutoReset = True
AddHandler t.Elapsed, AddressOf TimerFired
t.Enabled = True
t.Start()
End Sub

Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
t.Stop()
t.Dispose()
End Sub


Private Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
Dim objBeta As New BLBeta
t.Stop()

objBeta.GetAllFunctions()

t.Start()
End Sub


End Class


Ather...
Ather.Abbas  Thursday, September 10, 2009 7:05 AM
hi thanks for your reply .....acctually there is time problem... time is very small....

t = New Timers.Timer(1000) not working

t = New Timers.Timer(80000) now this working fine






Ather...
Ather.Abbas  Thursday, September 24, 2009 6:05 AM

Hi Ather.Abbas,

I have tested a similar project and met no issue, the event is fired. Based on my understanding, you need to check whether your service is installed and started correctly. You also need to check whether you debugged the program in a proper way.

The document below shows how to write a installer class to install a service. We need to add a similar class in our windows service project:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.aspx.

The document below shows how to install a service:
http://msdn.microsoft.com/en-us/library/sd8zc8ha.aspx.
If we use the InstallUtil command to install, we need to run the command under the cmd shell of the .Net framework. For example, in windows sdk 6.1, the menu on start menu is Microsoft Windows SDK v6.1->CMD Shell.

This document shows how to debug a windows service:
http://msdn.microsoft.com/en-us/library/7a50syb3.aspx.

Let me know if this does not help.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Monday, September 14, 2009 10:22 AM

Hi,

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, September 17, 2009 2:35 AM
hi thanks for your reply .....acctually there is time problem... time is very small....

t = New Timers.Timer(1000) not working

t = New Timers.Timer(80000) now this working fine






Ather...
Ather.Abbas  Thursday, September 24, 2009 6:05 AM

You can use google to search for other answers

Custom Search

More Threads

• Creating Windows Form based on XSD
• How to schedule a .Net windows service using win scheduled tasks service ?
• C# 3.0 - How to replace "this" when calling the property from someother class
• Multi language help please
• DataGrid Button column color
• Can I generate a managed resource DLL at run time?
• How to make autoscroll in MDI forms to be disabled
• Faster loading of assemblies
• Problems with Region.IsVisible[ptTest]
• Drawing and Form