I have been trying to get a System.Diagnostics.PerformanceCounter (.NET 2.) to work on a remote machine. I have rights to Performance Monitor Users group and
Performance Log Users group on the remote server and Admin on the local machine. I can't get the code to work (see exception below). If I elevate my rights to Admin, it works flawlessly. I need to find the minimum security rights I need to get the app to run. How can I go about determining what I need to grant. (p.s., granting read/write to the registry didn't work)
Thanks,
-Kevin
Unhandled Exception: System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name)
at System.Diagnostics.PerformanceCounterLib.FindCustomCategory(String category, PerformanceCounterCategoryType& categoryType)
at System.Diagnostics.PerformanceCounterLib.GetCategoryType(String machine, String category)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, String machineName)
at MyProjectNS.MyProject..ctor(String ProcessName, Int32 ScanFrequency, Boolean bDisplay, String MachineName, String username, String password, Int32 port) in F:\MyProject.cs:line 322
at MyProject.Main(String[] args) in F:\MyProject.cs:line 464
The Zone of the assembly that failed was:
MyComputer

Getting a PerformanceCounter to use a remote machine
Reznick
CleffedUp
just Do It
Mellis27
Please respond.
Thanks.
xetaksis
There has been a post on the BCL Team's blog
http://blogs.msdn.com/bclteam/archive/2006/09/08/746900.aspx which addresses this issue.
Does this solve your problem