【发布时间】:2012-02-06 17:08:11
【问题描述】:
按照in this MSDN article 的说明尝试创建自定义性能计数器时,我仍然遇到安全异常。
我使用的代码与那篇文章中的相同,只是我创建了不同的计数器。
我知道我可以尝试在启动任务中创建它,但现在我想在角色内部进行。它应该可以工作:/
例外:
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +12746267
System.Diagnostics.PerformanceCounterLib.CreateRegistryEntry(String categoryName, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection creationData, Boolean& iniRegistered) +170
System.Diagnostics.PerformanceCounterLib.RegisterCategory(String categoryName, PerformanceCounterCategoryType categoryType, String categoryHelp, CounterCreationDataCollection creationData) +49
System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) +558
我的 ServiceDefinition.csdef 的开头:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Jonathan.Cloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebDriver" vmsize="Small" enableNativeCodeExecution="true">
<Runtime executionContext="elevated" />
当我 RDP 进入角色时,我可以看到应用程序池仍在以 NetworkService 身份运行,当我将角色更改为“提升”时,我期望它在不同的主体下运行 - 手动设置自定义具有权限的主体解决了这个问题,但是一旦角色重新配置自身或我部署升级,它将被覆盖 - 无论如何,这不是真正的解决方案,而是一个黑客:/ [沮丧]
【问题讨论】:
-
您是否尝试过使用 Windows Azure Powershell Cmdlet 而不是自己封装管理 API?这是 David Aiken 关于如何使用 PowerShell 远程配置诊断信息的文章。 davidaiken.com/2011/10/18/…
标签: azure performancecounter azure-web-roles