Freigeben über


ASP.NET Performance counters missing

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

Comments

  • Anonymous
    April 11, 2008
    You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • Anonymous
    April 15, 2008
    One time I had a problem with the performance counters showing up but always with the value of 0, and it was because I was on a 64 bit operating system with ASP.NET running in 32 bit mode.  So when I open performance monitor, it was monitoring the 64 bit counters.  I opened the performance monitor from the 32 bit directory and then the ASP.NET counters showed the correct values.

  • Anonymous
    April 16, 2008
    Very good point Jonathan.  If you are running on a 64-bit OS, you have to be very careful which performance monitor you start as it will affect which counters you can see.

  • Anonymous
    April 21, 2008
    Thanks a lot! This post helped me to solve the problem at customer's alikl

  • Anonymous
    April 25, 2008
    perfect solution to one of my issues, thanks alot

  • Anonymous
    May 05, 2008
    The comment has been removed

  • Anonymous
    August 15, 2008
    Jonathan's comment above greatly helped me in figuring this out. I wasn't running the proper perfmon. The MSDN documentation should be updated with that information.

  • Anonymous
    September 23, 2008
    'aspnet_regiis.exe -i' did not produce any error messages.  Based on other research, I realized the registry keys might be wrong, so I did 'aspnet_regiis.exe -u' (to uninstall and delete the registry keys) followed by 'aspnet_regiis.exe -i' (to install and correctly set the keys in the registery).  The EventLog entries immediately ceased

  • Anonymous
    January 28, 2009
    I AM GETTING INTERMITANT,- MANY BOXES THAT Says   "16BIT MS-DOS SUBSYSTEM" ON TOP. Then it has The NTVDM cpu has encountered an illegal instruction and other things. How can I delete them so they won't keep coming back every few minutes, from my computer.  I am 94 years of age and an novice on the computer,would appreciate you help.

  • Anonymous
    April 04, 2010
    Have been dealing with this issue for years on many servers. Run misc fixes, think have it fixed, then a week, or a month later returns. Have logged over 50 hours researching, fixing. Giving up, time would be better spent going to a completely different O/S.

  • Anonymous
    April 05, 2010
    Fed up, if you really want to get it fixed, you should call Microsoft Support.  They should be able to get it fixed for good.  And with a lot less headache for you!

  • Anonymous
    March 20, 2012
    How can I read ASP.Net PerfMon counters when running in Azure? (some ASP.Net counters always return 0)

  • Anonymous
    November 27, 2012
    Method 3 helped me in of the scenario I am looking for. Thanks.