【问题标题】:Access performance counters for ASP.NET Web App in Microsoft Azure访问 Microsoft Azure 中 ASP.NET Web 应用程序的性能计数器
【发布时间】: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


    【解决方案1】:

    来自https://docs.microsoft.com/en-us/azure/application-insights/app-insights-performance-counters

    性能计数器不适用于 Azure Web 应用。但是你可以send Azure Diagnostics to Application Insights

    云服务或虚拟机将是解决方法 - 不是真正的解决方法,我知道更像是不同的游戏。

    您绝对可以将http://azureserviceprofiler.com 与应用服务一起使用,但我不知道您是否获得了所需的粒度。还是不错的,试试看吧。

    【讨论】:

    • “发送和收集统计信息”没有问题,收集该统计信息存在问题。 ADO.NET SqlConnection 池大小、活动、免费等只能通过性能计数器 (AFAIK) 获得,所以这里的问题是如何在 Azure 环境中访问 ADO.NET SqlConnection 池统计信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多