I just wrote a sample windows service application with the code provided at :
I built it and installed it. When I tried to run it from the service, it gives me the following error:
The portalreportscanner service on local computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.
When I check the error in event viewer I see the following:
Event Type: Error
Event Source: PortalReportScanner
Event Category: None
Event ID: 0
Time: 12:46:35 PM
Service cannot be started. System.ArgumentException: The source 'PortalReportScanner' is not registered in log 'PortalReportScannerLog'. (It is registered in log 'Application'.) " The Source and Log properties must be matched, or you may set Log to the empty
string, and it will automatically be matched to the Source property.
at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)
at System.Diagnostics.EventLog.WriteEntry(String message, Event
View Complete Post