View Single Post
  #1 (permalink)  
Old June 15th, 2004, 10:10 PM
newmike newmike is offline
Registered User
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issues about PerformanceCounter (Chapter 22)

Hi, all,

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
Date: 16/06/2004
Time: 2:49:42 p.m.
User: N/A
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 System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter.EndInit()
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.