Don't Forget to run the Install Services script after installing the Enterprise Library!

Published 19 March 05 07:03 PM | Scott Mitchell

Since my first article on 4Guys covering the Enterprise Library - An Introduction to the Enterprise Library - one question I have received at least a dozen times is the following:

When running an Enterprise Library example on my computer I get the following exception:

System.Security.SecurityException: Requested registry access is not allowed

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

Others have reported receiving this exception:

The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

Line XXX: ds = db.ExecuteDataSet(dbCommandWrapper)

What the problem boils down to is that the performance counters used by the Enterprise Library have not been installed. As discussed in Tom Hollander's blog entry Instrumentation in Enterprise Library:

One of the primary goals of Enterprise Library is to showcase best practices for enterprise .NET development. We try to do this in multiple domains, including architecture, code standards, unit testing and operations. ... So instrumentation is very important, which is why we made sure we included it in the blocks - including event log messages, WMI events and performance counters. ... Instrumentation is enabled by default, but to make sure everything is registered you'll need to run the Install Services script from the Start Menu, or run installutil over each assembly (possibly as a part of your own MSIs). When you install Enterprise Library with default settings, all of the code will be automatically compiled, but unfortunately we didn't run the Install Services script for you. This was an unfortunate outcome - but if you remember to run the script yourself then everything should work well.

Essentially the Data Access Appliation Block (DAAB) portion of the Enterprise Library attempts to log instrumentation information to performance counters. However, you must manually install these performance counters. If you do not, one of the above exceptions will occur because the EntLib can't find the performance counter it wants to write to.

Hopefully Google picks up this blog entry so folks searching on the exception can quickly find a resolution. I've also updated my two articles on 4Guys that cover the Enterprise Library - An Introduction to the Enterprise Library and Working with the Enterprise Library's Data Access Application Block (DAAB) - so that the text that discusses installing the services is red and bold. Hopefully that will catch peoples' eyes!

One last comment about the Enterprise Library - there are some great webcasts and PowerPoint slides on the Enterprise Library over at - definitely worth checking out!

Filed under:


No Comments


My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.