我想設置我的Azure Web應用程序以包含使用第三方軟件,這似乎需要訪問PerformanceCounters。本地這工作得很好,但是當我在Azure上運行它,我得到以下錯誤:Azure應用服務:使用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應用程序是可能的。有沒有辦法讓性能計數器在我的情況下工作?
嘗試將緩存客戶端應用程序帳戶添加到以下組:Performance Monitor Users組和Performance Log Users組,然後重新啓動緩存客戶端應用程序。 – Thennarasan
嘗試wbemtest「Win + R」並鍵入wbemtest並檢查錯誤。 –