Issues about PerformanceCounter (Chapter 22)
After I install the example code for performanceCounter (WinServices\QuoteService), the installation is done successfully, but the Window service "QuoteService" can not be startup, an error event is follows:
Event Type: Error
Event Source: QuoteService
Event Category: None
Event ID: 0
Time: 2:49:42 p.m.
The description for Event ID ( 0 ) in Source ( QuoteService ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: [u]Service cannot be started. System.InvalidOperationException: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.</u>
at Wrox.ProCSharp.WinServices.QuoteServer.InitializeC omponent()
at Wrox.ProCSharp.WinServices.QuoteServer..ctor(Strin g filename, Int32 port)
at Wrox.ProCSharp.WinServices.QuoteService.OnStart(St ring args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMai nCallback(Object state).
It looks like the way to setting an writable performance counter object is wrong. I did check some web page, did not find solution for this issue yet. Anyone has some idea for this issue?
BTW, My machine is Windows XP Pro + DotNet v1.1 + VS 2003, Thanks.