在Microsoft Azure中访问ASP.NET Web应用程序的性能计数器

在Microsoft Azure中访问ASP.NET Web应用程序的性能计数器,asp.net,.net,azure,database-connection,performancecounter,Asp.net,.net,Azure,Database Connection,Performancecounter,我正在开发一个诊断工具,它需要监视作为web应用程序发布到Azure的web应用程序端(asp.net)的活动/空闲/池数据库连接。从客户端进行监控很重要,因为我针对的是应用程序负载下连接池的某些问题 我在性能计数器类别中找到了SqlServer的.NET数据提供程序,我可以在本地访问它并跟踪所有需要的数据 不幸的是,一旦我将代码发布到Azure,我就遇到了以下异常:UnauthorizedAccessException:对注册表项“Global”的访问被拒绝 System.Unauthoriz

我正在开发一个诊断工具,它需要监视作为web应用程序发布到Azure的web应用程序端(asp.net)的活动/空闲/池数据库连接。从客户端进行监控很重要,因为我针对的是应用程序负载下连接池的某些问题

我在性能计数器类别中找到了SqlServer的.NET数据提供程序,我可以在本地访问它并跟踪所有需要的数据

不幸的是,一旦我将代码发布到Azure,我就遇到了以下异常:
UnauthorizedAccessException:对注册表项“Global”的访问被拒绝

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)
是否有任何方法可以访问Azure环境中我的Web应用实例的性能计数器?

来自:

性能计数器不适用于Azure Web应用程序。但是你可以

云服务或虚拟机将是解决方案——我知道,这并不是一个真正的解决方案,更像是一个不同的游戏


你肯定可以使用应用程序服务,但我不知道你是否得到了你想要的粒度。不过这很不错,试试看。

发送和收集统计数据没有问题,收集统计数据有问题。ADO.NET SqlConnection池大小、活动、可用等仅通过性能计数器(AFAIK)可用,因此这里的问题是如何在Azure环境中访问ADO.NET SqlConnection池统计信息。