We get this problem from time to time so I thought I would talk about what to do when the performance counters are missing for ASP.NET.

Method 1

The first piece of advice is to upgrade to the latest version of the framework, so the latest Service Pack.  This will make sure you have any fixes that may have already been done to help the issue.  You can get the latest Service Pack here.

Method 2

The next step, if that doesn’t help is to try running the ASP.NET IIS Registration Tool yourself and see if that works correctly.  You can run this by going into your .NET folder (%WINDIR%\Microsoft.NET\<framework version>) and running:

aspnet_regiis.exe -i

If aspnet_regiis gives an error, you can look at the error log that it references for clues of what is wrong, like permissions:

D:\WINNT\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i
Start installing ASP.NET (2.0.50727).
.............
Finished installing ASP.NET (2.0.50727).
Setup has detected some errors during the operation.
For details, please read the setup log file
D:\DOCUME~1\FWTLABB\LOCALS~1\Temp\ASPNETSetup_00006.log

Method 3

If neither of those help matters, then we can try doing something a little more drastic.  The following steps are another way to try to get them added:

  1. Check the following Registry key and make sure that it points to the correct
    aspnet_perf.dll:
    HKLM\SYSTEM\CurrentControlSet\Services\
    ASP.NET_2.0.50727\Performance\Library
  2. Perform the following steps:
    a. Shut down IIS.
    net stop iisadmin /y
    b. Shut down the "Remote Registry" service.
    net stop "remote registry"
    c. Shut down anything else that might be monitoring performance (i.e. Perfmon).
    d. Run the following commands to unload/reload the per counter texts:
    unlodctr ASP.NET_2.0.50727
    unlodctr ASP.NET_64_2.0.50727
    unlodctr ASP.NET
  3. Then from the v2.0.50727 folder, do this from the Framework64 and Framework folders:
    lodctr aspnet_perf.ini
    lodctr aspnet_perf2.ini
  4. Restart IIS.
    net start iisadmin

Now check the following key and see if there is a new entry:

HKLM\SYSTEM\CurrentControlSet\Services\
ASP.NET_2.0.50727\Names
HKLM\SYSTEM\CurrentControlSet\Services\
ASP.NET_64_2.0.50727\Names

The name is a long random thing, but the data should be the PID of the worker process that is running. If this works, then the ACL for the key is correct. If there is no entry (even though ASP.NET pages are executing) then there is an ACL issue with the key. Make sure that the worker process identity can write to that key.

If the .NET counters are also missing, you can add the following to the steps above:

in step 2. c:

unlodctr ".NETFramework" 
unlodctr ".NET CLR Data" 
unlodctr ".NET CLR Networking" 
regsvr32 /u C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll 
regsvr32 /u C:\WINNT\system32\mscoree.dll 
regsvr32 C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll 
regsvr32 C:\WINNT\system32\mscoree.dll 

in step 3:

lodctr CORPerfMonSymbols.ini 
lodctr _dataperfcounters.ini 
lodctr _NetworkingPerfCounters.ini 

Note: For 1.1, replace aspnet_perf.dll with aspnet_isapi.dll in the above steps.

Method 4

One more issue, if you have installed the security fix for MS07-040 and try to open perfmon and add a counter and after not seeing ASP.NET in the list, if you look in your Event Log and see an error:

Event Type: Error
Event Source: Perflib
Event Category: None
Event ID: 1008
Date:  7/11/2007
Time:  1:03:15 PM
User:  N/A
Computer: BAD02
Description:
The Open Procedure for service "ASP.NET" in DLL "
C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll" 
failed.  Performance data for this service will not be 
available. Status code returned is data DWORD 0. 
Data:
0000: 05 40 00 80

Try getting the fix from KB 944746

I’ll update this post if any additional methods are discovered to fix this issue.

kick it on DotNetKicks.com