I just wrote a sample windows service application with the code provided at : http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx
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
Date: 2010-09-21
Time: 12:46:35 PM
User: N/A
Computer: W3560
Description:
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, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message)
at PortalReportScanner.PortalReportScanner.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
I tried the same code in another pc and go tht e same error. Could any one help me to fix this error please? Any help is greatly appreciated.
donsls