Access to the registry key 'Global' is denied


When working with System.Diagnostics.PerformanceCounter class, you have to grant the correct permissions to the App Pool, otherwise the server will respond with an error: System.UnauthorizedAccessException: Access to the registry key 'Global' is denied.

It is a registry permission issue. The workaround is to add the client application account to the following groups: Performance Monitor Users group and Performance Log Users group.

To do this, open up the CMD with Administrator privileges, then run the following commands:

net localgroup "Perfomance Monitor Users" DefaultAppPool /add

net localgroup "Perfomance Log Users" DefaultAppPool /add

Note: If you are not using DefaultAppPool as your App Pool, just replace with the correct app pool name.


Leave a Comment