Windows Service (Memory and Error Handling)

I have a windows service that triggers every minute, it uses IIS for the remote object calls, all on one machine at the moment. The service runs fine for hours but then appears to stop despite showing as running in services.

My questions are should I be forcing garbage collection on the objects? What type of error handling is best here? Is there a global error handler I can assign to the service?

Any help would be appreciated
Who is Participating?
Only thing I can say is add exception handling and make sure you release resources that you don't need.
Show us some code. What is the service doing?
rocky050371Author Commented:
I cant really display any other code

Dim props As New Collections.Specialized.ListDictionary()
        props.Add("UseDefaultCredentials", True)
        _channel = New HttpChannel(props, New SoapClientFormatterSinkProvider(), New SoapServerFormatterSinkProvider())
        ChannelServices.RegisterChannel(_channel, False)

        If Not EventLog.Exists(EVENTLOGNAME) Then
            EventLog.CreateEventSource(EVENTLOGNAME, EVENTLOGNAME)
        End If

        _timer = New Timer
        _timer.Interval = CType(ConfigurationManager.AppSettings("poll_Duration"), Double)
        _timer.Enabled = True

        AddHandler _timer.Elapsed, AddressOf _timer_Tick

        EventLog.WriteEntry(EVENTLOGNAME, "Scheduler Started", EventLogEntryType.Information)

 Private Sub _timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        SyncLock Me

            EventLog.WriteEntry(EVENTLOGNAME, "", EventLogEntryType.Information)

        End SyncLock

    End Sub

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.