From: Andrew Raastad on
I have a Windows Service that runs on our 32bit servers, but wanted to test
it out on our 64bit test server (Win Server 2008 R2), so I used the
InstallUtil.exe utility to install it manually. This worked ok, and when I
start the Service it seems to run fine, but then after a few seconds it
stops. The only error I can find is in the Event Log: "The NetPractice
Interface Service service terminated unexpectedly. It has done this 1
time(s)." This seems to be a default error message by the O/S, but in the
code I have a method that should be writing errors to its own Event Log:

Private Sub WriteEvent(ByVal evt As String, Optional ByVal type As
EventLogEntryType = EventLogEntryType.Information)
' Create a Log File if the NetPractice IFS Log doesn't exist
If Not EventLog.SourceExists("NetPractice IFS") Then
EventLog.CreateEventSource("NetPractice IFS", "NetPractice Log")
End If

' Print the status message or error message to the Log File
EventLog.WriteEntry("NetPractice IFS", "[Worker Process]" & vbCrLf &
evt, type)
End Sub

This code works just fine on our Win Server2003 boxes, but on this test
machine the custom Event Log is not created, and no entries are to be found.
Just to be sure I double-checked my code against the MSDN
(http://msdn.microsoft.com/en-us/library/hk2a9kek.aspx) and it shows I'm
doing it right, but it doesn't seem to be working.

Can someone tell me if I am doing something wrong? I need to know why the
Service is stopping unexpectedly.

-- Andrew