2

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?

1 Answer 1

2

From https://learn.microsoft.com/en-us/azure/application-insights/app-insights-performance-counters:

Performance counters aren't available for Azure Web Apps. But you can send Azure Diagnostics to Application Insights.

Cloud Services or VMs would be the workaround - not really a workaround, more like a different game, i know.

You can definitely use http://azureserviceprofiler.com with App Service, but i don't know if you get the granularity you're looking for. It's pretty good though, try it.

Sign up to request clarification or add additional context in comments.

1 Comment

there is no issue with 'sending and collecting stats', there is an issue to gather that stats. ADO.NET SqlConnection Pool size, active, free, etc is available only via Performance Counters (AFAIK), so the question here is how to access ADO.NET SqlConnection Pool stats in Azure Environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.