Uncategorized

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 :==================

C:\WINDOWS\system32\axperf.ini:drivername=ASP
C:\WINDOWS\system32\esentprf.ini:drivername=ESENT
C:\WINDOWS\system32\ftpctrs.ini:drivername=MSFTPSVC
C:\WINDOWS\system32\iasperf.ini:drivername=IAS
C:\WINDOWS\system32\infoctrs.ini:drivername=inetinfo
C:\WINDOWS\system32\mqperf.ini:drivername=MSMQ
C:\WINDOWS\system32\msdtcprf.ini:drivername=MSDTC
C:\WINDOWS\system32\ntdsctrs.ini:drivername=NTDS
C:\WINDOWS\system32\ntfrscon.ini:drivername=FileReplicaConn
C:\WINDOWS\system32\ntfrsrep.ini:drivername=FileReplicaSet
C:\WINDOWS\system32\perfci.ini:drivername=ContentIndex
C:\WINDOWS\system32\perffilt.ini:drivername=ContentFilter
C:\WINDOWS\system32\perfwci.ini:drivername=ISAPISearch
C:\WINDOWS\system32\pschdprf.ini:drivername=PSched
C:\WINDOWS\system32\rasctrs.ini:drivername=RemoteAccess
C:\WINDOWS\system32\tslabels.ini:drivername=TermService
C:\WINDOWS\system32\w3ctrs.ini:drivername=W3SVC

================  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
Reboot
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

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Spooler\Performance
Value name: Disable Performance Counters
Value type: REG_DWORD
Value data: 1

A few fixes

Some How To and general articles

 

Carlo

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

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.