Various .NET Performance Counter Problems

 

Problem 1: ASP.NET performance objects disappeared

 

There are two ways to reload the counters again. First one is using “unlodctr/lodctr” command utility. Here are the detail steps:

1. Logon to the server with administrator privilege

2. Open a command window and go to the .net framework installation folder, for example:

%Windows%\Microsoft.NET\Framework\v2.0.50727

3. Run follow commands:

a. “Unlodctr asp.net”

 This command unloads the ASP.NET/ASP.NET Applications performance objects.

b. “Unlodctr asp.net_v2.0.50727”

This command unloads the “ASP.NET Apps v2.0.50727” and “ASP.NET v2.0.50727” performance counters.

c. “lodctr aspnet_perf.ini”

This command loads the “ASP.NET Apps v2.0.50727” and “ASP.NET v2.0.50727” performance counters again.

d. “lodctr aspnet_perf2.ini”

This command loads the ASP.NET/ASP.NET Applications performance objects again.

Another way is register the asp.net again.

1. Logon to the server with administrator privilege

2. Open a command window and go to the .net framework installation folder, for example:

%Windows%\Microsoft.NET\Framework\v2.0.50727

3. Run “aspnet_regiis -ir” command.

4. A more thorough way is run “aspnet_regiis -u” to unregister asp.net and then run “aspnet_regiis -i” to register again.

5. Please do IIS backup before this as this will change the “scriptmaps”. Restore the IIS settings after re-registered asp.net again.

Problem 2: “lodctr” failed to create the ASP.NET performance objects

 

Lodctr is not used to create performance objects; it is used to update registry values related to performance counters. We checked follow registry, and found there is no values under it which means the counters maybe removed or deleted manually.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ASP.NET_2.0.50727\Performance

The problem can be resolved via follow ways:

1. Export above registry item from a working one.

2. Import into the problematic server.

3. Delete follow values:

First Counter

First Help

Last Counter

Last Help

4. Run “lodctr” again.

Problem 3: Duplicated .Net performance objects

 

This problem was caused by other applications which build its own performance counters based on .Net performance counters. My problem was caused by Enterprise Library. The “Enterprise Library” performance counters were not installed correctly. This problem can be fixed by remove the “Enterprise Library” performance counters or install them correctly.

Unlike ASP.NET performance counters, Enterprise Library doesn’t contain a performance counter ini file. So, we can’t correct them by “unlodctr/lodctr”. We must rebuild the Enterprise Library performance counters by installutil.exe shipped by Microsoft .Net Framework.

Installutil.exe uses reflection to inspect the specified assembly and find all Installer types with the RunInstallerAttribute set to true. The tool then executes either the Install Method or the Uninstall Method on each instance of the Installer type. Installutil.exe performs installation in a transactional manner; if one of the assemblies fails to install, it rolls back the installations of all other assemblies. Uninstall is not transactional.

For example, follow command can uninstall the Enterprise Library Caching Counter performance counters.

Installutil /u Microsoft.Practices.EnterpriseLibrary.Caching.dll

This command can install the performance counters again:

Installutil Microsoft.Practices.EnterpriseLibrary.Caching.dll

See you next Time.

Zhao Wei