Microsoft KB Archive/922775

From BetaArchive Wiki

Article ID: 922775

Article Last Modified on 8/14/2007



APPLIES TO

  • Microsoft .NET Framework 2.0



SUMMARY

This article describes how to use common language runtime (CLR) performance counters and how to resolve known issues that occur when you use performance counters in the Microsoft .NET Framework 2.0. To monitor performance counters on a remote computer, you must be an administrator on the remote computer. If the remote computer is running Microsoft Windows Server 2003, you must be in the Performance Log Users (PLU) group or in the Performance Monitor Users (PMU) group. To log CLR performance counters, configure the user to run as a user who has administrative permissions. This article discusses issues that are related to monitoring or logging on CLR performance counters on remote computers.


INTRODUCTION

The CLR supplies managed code together with services such as the following:

  • Cross-language integration
  • Code access security
  • Object lifetime management
  • Resource management
  • Type safety
  • Pre-emptive threading
  • Metadata services (type reflection)
  • Debugging and profiling support

The CLR has performance counters that you can use to track the functionality of an application. You can use Performance Monitor (Perfmon) to create custom performance counters. You can monitor system performance by reviewing the values that the performance counters return.

MORE INFORMATION

The following known issues may occur when you use CLR performance counters in the .NET Framework 2.0.

You cannot remotely monitor the CLR performance counters

When you try to monitor the CLR performance counters on a remote computer in Perfmon, you receive an error message that resembles the following:

Unable to connect to machine

To resolve this issue, use one of the following methods.

Method 1: Verify that the Remote Registry service is running on the remote computer

When this issue occurs, verify that the Remote Registry service is running on the remote computer. To do this, follow these steps:

  1. Click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, type tasklist -svc, and then press ENTER.


Verify that a Svchost.exe host process is running that has RemoteRegistry in the Services column. If the service is not running, go to step 3.

  1. At the command prompt, type net start RemoteRegistry, and then press ENTER.

Method 2: Verify that you have the required permissions

To monitor CLR performance counters on a remote computer, the following conditions must be true:

  • You must be a member of the Administrators group on the remote computer.
  • If the remote computer is running Windows Server 2003, you must be a member of the Performance Monitor Users group to monitor performance counters.
  • If the remote computer is running Windows Server 2003, you must be a member of the Performance Log Users group to log the performance counters. Additionally, you must use the Run As command to configure the logging process to run under the Administrators group or under the Performance Log Users group.

You cannot view CLR performance counters even though you can connect to the remote computer

If the Windows Server 2003-based remote computer is running the Microsoft .NET Framework 1.1 Service Pack 1 (SP1), apply the hotfix that is described in the following Microsoft Knowledge Base article:

924421 FIX: Application performance deteriorates or the computer stops responding when you run a .NET Framework 1.1 Service Pack 1-based application on a Windows 2003-based computer


You receive an "ACCESS_DENIED" error message when you try to start logging CLR performance counters

When you try to start logging CLR performance counters, you may receive an error message that resembles the following:

Error code 5 (ACCESS_DENIED)
Unable to open shim database version registry key - v2.0.50727.00000. The Open Procedure for service ".NETFramework" in DLL "D:\WINNT\system32\mscoree.dll" failed. Performance data for this service will not be available. The Status code returned is the first DWORD in the attached data. The status code is 5 (ACCESS_DENIED)

This issue occurs because the first process to load the CLR performance counter DLL (Corperfmonext.dll) creates a named event for Inter-Process Communication (IPC) communication. A named event is created that uses the permissions for the user ID of the process.

For example, a user who has administrative permissions starts Perfmon. Then, the user begins to monitor CLR performance counters. The named event is created by using permissions that are granted to the Administrator group. In this scenario, the user receives the error message if the user tries to start logging CLR performance counters. This issue occurs because the "Performance Logs and Alerts" service cannot access the named event.

To work around this issue, load the Corperfmonext.dll file in the "Performance Logs and Alerts" service first. To do this, follow these steps:

  1. Click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, type tasklist -m corperfmonext.dll, and then press ENTER. Note each process that is listed.
  3. At the command prompt, type taskmgr, and then press ENTER.
  4. On the Processes tab, click each process that you noted in step 2, and then click End Process.
  5. Click Start, click Run, type Perfmon, and then click OK.
  6. Expand Performance Logs and Alerts, and then click Counter Logs.
  7. Right-click the service that you want to use, and then click Start.

Note This issue is scheduled to be fixed in a future version of the .NET Framework.

You cannot monitor 32-bit managed programs in the 64-bit version of Perfmon

This issue occurs because the 64-bit version of the Corperfmonext.dll file only enumerates 64-bit processes. Additionally, the 32-bit version of the Corperfmonext.dll file only enumerates 32-bit processes. To view 32-bit managed programs on a 64-bit computer, click Start, click Run, type SystemRoot%\SysWOW64\perfmon.exe, and then click OK.

Note This issue is scheduled to be fixed in a future version of the .NET Framework.

Perfmon does not detect when a managed program restarts on the remote computer

This issue occurs because the Remote Registry service runs under the Local Service account. The Local Service account is not a member of the Performance Monitor Users group or of the Performance Log Users group. Therefore, the Local Service account does not have access to the CLR performance counter IPC block. Nevertheless, you can monitor CLR performance counters because the Remote Registry service impersonates the user who initiated the monitoring.

However, if the monitored process restarts, a new IPC block is opened by an auxiliary thread in the Remote Registry service. This auxiliary thread does not impersonate the user on the client. Therefore, the thread cannot access the CLR performance counter IPC block. To work around this issue, restart the performance counter monitoring from the client.

Multiple CLR performance counters appear that have names that resemble "W3wp#1"

When multiple ASP.NET workers processes are running, CLR performance counters that have names that resemble "W3wp#1" or "W3sp#2" may appear. In the .NET Framework 2.0, a counter that is named Process ID was added to the .NET CLR Memory performance object. This counter displays the process ID for an instance. You can use this counter to determine the CLR performance counter that is associated with a process.

If you cannot see a counter that is named Process ID under .NET CLR Memory, the performance counter symbols may not be installed correctly. To resolve this issue, follow these steps:

  1. Click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, type unlodctr .NetFramework, and then press ENTER.
  3. Use the cd command to change to the \Microsoft.Net\Framework\v2.0.50727 folder.
  4. At the command prompt, type lodctr corperfmonsymbols.ini, and then press ENTER.



Additional query words: kbRD, kbRPC

Keywords: kbtshoot kbregistry kbperformancetool kbinput kbmsg kbperfmon kbprb kbfaq KB922775