Ups and downs of ASP.NET Performance Counters

Perfmon is likely the first tool you think to when it comes to monitor some internals and performance of your application and it’s relatively easy to find out information and resources on the Internet; unfortunately this seems to also be a fragile component and every now and then we receive new calls about it: event log spammed with warnings about missing or corrupted counters, values returned are inconsistent or clearly wrong etc…

Messages like the following can appear after for example installing the .NET Framework 2.0 on your machine:

The Open Procedure for service "ASP.NET" in DLL "C:\Windows\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

To note that such warnings are logged even if your application is not running.

Some troubleshooting

First of all you can try to disable any third party services and processes (for example using msconfig.exe or Autoruns) and see if the problem still reproduces. If it does, you can use How to manually rebuild Performance Counter Library values to try to fix it manually, or try the following:

  • Uninstall the  .NET Framework 2.0
  • If available for Perfc009.dat, Perfh009.dat and Perfh007.dat , Perfh007.dat, backup the registry keys
    • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
    • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\Perflib
  • Open a command prompt to your System32 folder
    • REN perf?009.dat *.bak
    • Expand <CD_drive_letter:>\i386\perfc009.DA_ %systemroot%\system32\perfc009.DAT
    • Expand <CD_drive_letter:>\i386\perfd009.DA_ %systemroot%\system32\perfd009.DAT
    • Expand <CD_drive_letter:>\i386\perfh009.DA_ %systemroot%\system32\perfh009.DAT
    • Expand <CD_drive_letter:>\i386\perfi009.DA_ %systemroot%\system32\perfi009.DAT
    • REN perf?007.dat *.bak
    • Expand <CD_drive_letter:>\i386\perfc007.DA_ %systemroot%\system32\perfc007.DAT
    • Expand <CD_drive_letter:>\i386\perfd007.DA_ %systemroot%\system32\perfd007.DAT
    • Expand <CD_drive_letter:>\i386\perfh007.DA_ %systemroot%\system32\perfh007.DAT
    • Expand <CD_drive_letter:>\i386\perfi007.DA_ %systemroot%\system32\perfi007.DAT
  • Open your system registry (be very careful!) to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib and set
    • Last Counter = 1846 (decimal) or 736 (hex)
    • Last Help = 1847 (decimal) or 737 (hex)
  • Now move to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
  • Search for the subkey Performance  in services and set the values
    • First Counter = 0
    • First Help = 0
    • Last Counter = 0
    • Last Help = 0
  • Back to the command prompt (still in System32)
  • findstr drivername *.ini > Perfini.txt
  • open  Perfini.txt  and note  drivername=nnn

================  sample  Perfini.txt :==================


================  Sample Perfini.txt :==================

Using this information  unload und load the counter in  System32:

unlodctr <drivername>
lodctr <ini file>
<drivername>  driver’s name from  Perfini.txt
<ini file>  listed  “.ini” files  in  Perfini.txt  

Example:  ASP Drivername: axperf.ini:drivername=ASP 

unlodctr ASP
lodctr axperf.ini

Or using the following command you can transfer settings from a  working machine to a not working one: 

lodctr /s:Perf_all.ini
lodctr Perf_all.ini
Check Perfdiag 

Disable not needed counters (as a last resource)

If nothing else works as you wish or you do not want to waste time troubleshooting and just need the machine up and running without much annoyances you can disable the counters for the problematic service(s), of course at the cost of not having those data if you’ll ever need them.

For this task you can use Exctrlst.exe utility from the OS Resource Kit (see Exctrlst Overview and Exctrlst UI); it disables the specific counter by adding a registry key similar to the example below. You can add these registry entries under the specific counter entry manually if Exctrlst.exe is not available or desirable

Value name: Disable Performance Counters
Value type: REG_DWORD
Value data: 1

A few fixes

Some How To and general articles



Quote of the day:
The only time people dislike gossip is when you gossip about them. – Will Rogers

Comments (1)

  1. Carlo, va menzionato che su Windows Server 2003 (non valeva su 2000) esiste anche

    lodctr /R

    che tenta di "aggiustare" un po’ tutti i counters di sistema (e spesso riesce) in automatico.

    vale la pena provare se gia’ quello risolve.

    Se poi quello non va, tutta la procedura di ricostruzione con UNLODCTR && LODCTR che hai descritto e’ ovviamente la migliore (togli e ricarichi i SINGOLI counter, per applicazione/servizio).

    Inoltre vale la pena notare che, quando togli e rimetti i counter a quel livello, alcune applicazioni di monitoring che accedono ai dati dallo strato piu’ alto (WMI) e non con le performance library, potrebbero ancora avere problemi…. pertanto, dopo aver fatto la procedura consigliata da te conviene anche fare un bel



    per ri-sincronizzare le informazioni tra le performance library e le classi WMI che le ri-espongono.

    Ciao, keep up the grat work, il tuo blog e’ sempre una bella lettura – utile e informativo!!!