[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Performance Counter problem; corrupt?

Todd Seiber

8/27/2003 3:31:00 PM

I have encounter the following error:
----------------------------------------------------------------------------
--------------
Service cannot be started. System.InvalidOperationException: Cannot create
file mapping.
at System.Diagnostics.FileMapping.Initialize()
at System.Diagnostics.FileMapping..ctor()
at System.Diagnostics.SharedPerformanceCounter.get_FileView()
at System.Diagnostics.SharedPerformanceCounter.ResolveOffset(Int32 offset)
at System.Diagnostics.SharedPerformanceCounter.GetCounter(String
categoryName, String counterName, String instanceName)
at System.Diagnostics.SharedPerformanceCounter..ctor(String categoryName,
String counterName, String instanceName)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String
counterName, String instanceName, Boolean readOnly)
at xhpRegulator.Service1.OnStart(String[] args) in
C:\xxxxxxxxxxxxxxx.vb:line 316
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
----------------------------------------------------------------------------
-----------

There error has occurred after numerous time of running the application
without such error. The performance counters were created and also read
from PerfMon. Perhaps am I encountering some file or registry corruption?

Code:
----------------------------------------------------------------------------
------------
Dim pcc As PerformanceCounterCategory

If Not pcc.Exists("XHPR") Then
Try
Dim perfCounters As New CounterCreationDataCollection()
perfCounters.Add(New CounterCreationData("Msg Errors", "",
PerformanceCounterType.NumberOfItems32))
perfCounters.Add(New CounterCreationData("Oversize Msg
Errors", "", PerformanceCounterType.NumberOfItems32))
perfCounters.Add(New CounterCreationData("Processed Msgs",
"", PerformanceCounterType.NumberOfItems32))
perfCounters.Add(New CounterCreationData("Proc In Use", "",
PerformanceCounterType.NumberOfItems32))
perfCounters.Add(New CounterCreationData("Backend Auth
Errors", "", PerformanceCounterType.NumberOfItems32))
perfCounters.Add(New CounterCreationData("Queue Depth", "",
PerformanceCounterType.NumberOfItems32))

pcc = pcc.Create("XHPR", "XHP Regulator", perfCounters)

Catch e As Exception
Write2Log(e.ToString, EventLogEntryType.Error)
End Try
End If

pcMsgs = New PerformanceCounter("XHPR", "Processed Msgs",
Me.ServiceName, False) ' **** Line 316 ****
pcMaxMsg = New PerformanceCounter("XHPR", "Oversize Msg Errors",
Me.ServiceName, False)
pcErrors = New PerformanceCounter("XHPR", "Msg Errors",
Me.ServiceName, False)
pcBeAuthErr = New PerformanceCounter("XHPR", "Backend Auth Errors",
Me.ServiceName, False)
pcQueueDepth = New PerformanceCounter("XHPR", "Queue Depth",
Me.ServiceName, False)