I'm working on a diagnostics tool which needs to monitor active/free/pooled database connections from the web application side (asp.net) published to the Azure as a Web App. It's important to monitor from the client side because I'm targeting certain issues with connection pooling under app load.
I found all the required information in the performance counter category .NET Data Provider for SqlServer which I was able to access locally and track all the required data.
Unfortunately, once I published the code to the Azure I got the following exception: UnauthorizedAccessException: Access to the registry key 'Global' is denied
System.UnauthorizedAccessException: Access to the registry key 'Global' is denied.
at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
at Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity)
at Microsoft.Win32.RegistryKey.GetValue(String name)
at System.Diagnostics.PerformanceMonitor.GetData(String item)
at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String category)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
at System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName)
Is there any way I can access performance counter for my Web App instance in Azure environment?