1

PerformanceCounters에 액세스해야하는 타사 소프트웨어의 사용을 포함하도록 Azure Web App를 설정하려고합니다. 로컬이 잘 작동하지만 내가 푸른에서 실행할 때 다음과 같은 오류 얻을 :Azure App 서비스 : PerformanceCounters 사용

[UnauthorizedAccessException: Access to the registry key 'Global' is denied.] 
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +5230217 
Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity) +11769029 
Microsoft.Win32.RegistryKey.GetValue(String name) +40 
System.Diagnostics.PerformanceMonitor.GetData(String item) +102 
System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item) +186 
System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +105 
System.Diagnostics.PerformanceCounterLib.GetCategorySample(String category) +17 
System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category) +61 
System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName) +70 
System.Diagnostics.PerformanceCounterCategory.GetInstanceNames() +25 

this answer에 따르면, 나는 응용 프로그램 풀/사용자에게 액세스를 허용하도록 IIS를 구성해야합니다,하지만 내가 생각하지 않습니다 Azure Web App에서 가능합니다. 내 상황에서 성능 카운터를 작동시키는 방법이 있습니까? Windows에서

+0

성능 모니터 사용자 그룹 및 성능 로그 사용자 그룹 캐시 클라이언트 응용 프로그램 계정을 추가하고 캐시 클라이언트 응용 프로그램을 다시 시작하십시오. – Thennarasan

+0

wbemtest "Win + R"을 입력하고 wbemtest를 입력하고 오류를 확인하십시오. –

답변

1

는 성능 카운터는 WMI를 통해 액세스 할 수 있습니다 :
https://msdn.microsoft.com/en-us/library/aa392397(v=vs.85).aspx

WMI는 앱 서비스 샌드 박스에 제한됩니다. https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#access-to-out-of-process-com-servers에서
: 쿠두에서

Access to out-of-process COM servers

Windows Servers have a bunch of COM servers configured and available for consumption by default; however the sandbox prevents access to all out-of-proc COM servers. For example, a sandboxed application cannot call into WMI, or into MSIServer.

:

PS D:\home> Get-Counter -Counter "\processor(_total)\% processor time" 
Get-Counter : The specified object was not found on the computer. 


PS D:\home> Get-WmiObject -Class WIN32_OperatingSystem 
Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 
(E_ACCESSDENIED)) 

당신이 절대적으로 (웹 역할) 푸른 클라우드 서비스를 보면, 제 3 자 소프트웨어를 사용해야하는 경우. 당신은 여전히 ​​PaaS 인 동안 운영 체제를 완전히 제어 할 수 있습니다.

+0

이것은 내가 두려워했던 것입니다. 이전에 클라우드 서비스에서 Worker Role을 사용하여 소프트웨어를 실행했지만 테스트를 위해 과도 함으로 비용이 적게 드는 것을 원했습니다. 나는 운이없는 것 같다. –

관련 문제