【发布时间】:2017-06-13 23:44:37
【问题描述】:
我正在开发一个诊断工具,该工具需要监视从作为 Web 应用程序发布到 Azure 的 Web 应用程序端 (asp.net) 的活动/空闲/池数据库连接。从客户端进行监控很重要,因为我的目标是在应用负载下连接池的某些问题。
我在性能计数器类别.NET Data Provider for SqlServer 中找到了all the required information,我可以在本地访问它并跟踪所有需要的数据。
不幸的是,一旦我将代码发布到 Azure,我得到了以下异常: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)
有什么方法可以在 Azure 环境中访问我的 Web 应用实例的性能计数器?
【问题讨论】:
标签: asp.net .net azure database-connection performancecounter