Windows Service will not create event messages
I have created a windows service and have it installed. When I try to start the service, I get a message box named JIT Debugging with a message stating that access is denied. Then another message box stating the service could not be started.
My service is create with this code to create the event log.
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
If Not EventLog.SourceExists("AdminReportSource") Then
EventLog.CreateEventSource("AdminReportSource", "AdminReportLog")
End If
eLog.Source = "AdminReportSource"
eLog.Log = "ReportLog"
End Sub
Then in the OnStart sub, I try to write out a message.
Protected Overrides Sub OnStart(ByVal args() As String)
eLog.WriteEntry("AdminReportService Started.")
End Sub
If I comment out WriteEntry, the services starts. Why am I unable to create event messages?
|