locked
Timer Control in WCF Service hosted in Window Service? RRS feed

  • Question

  • I want to call my WCF service which is hosted in Window Service on a regular interval period. I know I have to use the Timer control to invoke the service but I am not clear on the below points.:

    Which Timer Control I should use?

    Where should I write my code in Service Implementation class, or the Widows Service Host Project where I have written my below code.

    Can anybody clear these points? Thanks in advance.

    Protected Overrides Sub OnStart(ByVal args() As String)
     If myHost IsNot Nothing Then
                myHost.Close()
            End If
            myHost = New ServiceHost(GetType(Sentry_TaskManagerVersion3.SentryTMDemoVer3))
            myHost.Open()
     End Sub
    ------
       Protected Overrides Sub OnStop()
            ' Add code here to perform any tear-down necessary to stop your service.
            If myHost IsNot Nothing Then
                myHost.Close()
                myHost = Nothing
            End If
        End Sub

    Friday, May 11, 2012 1:45 PM

Answers

All replies