Monday, January 29, 2007

Failed to create instances of performance counter errors in .Net

I was getting errors like foll in my event log:

Failed to create instances of performance counter 'Total Command Executions' - The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

Failed to create instances of performance counter 'Average Command Execution Time' - The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

Failed to create instances of performance counter '# of Commands Executed/Sec' - The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

I was able to solve this by running installutil.exe over each of the Microsoft Enterprise LIbrary dlls. I copied the installutil.exe file (located in the WINNT\microsoft.net\framework\v1.1.4322\ directory to the directory where I had the Enterprise Library assemblies. ANd then ran it over each of the dlls. That solved the problem.

No comments: