Access performance counter programmatically in Microsoft Azure web app

元气小坏坏 提交于 2019-12-02 13:30:17

问题


Is it possible to access CPU, RAM and ASP.NET requests performance counter from web app via some API? When I call it using System.Diagnostics.PerformanceCounter.NextValue method I get exception:

Access to the registry key 'Global' is denied. 

I have seen examples with Web Roles, but nothing about websites.


回答1:


According to this Microsoft Article it is not supported on Azure Websites:

Windows Performance counter collection isn’t supported on an Azure WebSite

You can however monitor the CPU usuage and Memory Working set using the Monitor tab in the old management portal or directly on the website "blade" using the new portal. Maybe you can get these data out programatically using Microsoft.WindowsAzure.Management.WebSites




回答2:


It's related to permission issue here is the solution for that. Step 1: Just add an app.manifest file into particular solution step 2: add the following tag into manifest file.

< requestedExecutionLevel level="highestAvailable" uiAccess="false" />

Step 3: Finish.



来源:https://stackoverflow.com/questions/29632001/access-performance-counter-programmatically-in-microsoft-azure-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!