首页 新闻 会员 周边

急求答案!关于Windows Server 2012 64位+iis8.0+asp.net 无法读取cpu、内存、硬盘信息的问题

0
悬赏园豆:50 [已解决问题] 解决于 2014-03-11 13:02

今天部署web程序,部署完毕后,系统有个展示服务器cpu使用率、内存使用率、硬盘使用率信息的页面报错。这个系统原来部署在测试服务器上(server2003 32位+iis6.0)的,一切正常。正式上(Windows Server 2012 64位+iis8.0)就不行了。

错误信息是:对注册表项“Global”的访问被拒绝

根据这个错误提示网上找了一些解决方案都不行:

IIS-属性-目录安全性-身份验证和访问控制-编辑-启用匿名访问 ;

文件夹   ->   右键   ->   安全   ->   把everyone用户的读写权限都加上

webconfig加 <identity impersonate="true"/>

---------------------------------------------------------------------------

实在没办法了,特来博客园求助!各位达人有遇到类似的问题吗?江湖救急啊!

项目上线在即,各位看见的给支个招吧

baoerzhang的主页 baoerzhang | 初学一级 | 园豆:86
提问于:2014-03-10 19:31
< >
分享
最佳答案
2

你把应用程序池的标识从 ApplicationPoolIdentity 修改为 NetworkService 试试。

收获园豆:50
Launcher | 高人七级 |园豆:45045 | 2014-03-11 09:30

刚去机房试了一下,还是不行,您看一下错误信息:


“/Web”应用程序中的服务器错误。
--------------------------------------------------------------------------------


对注册表项“Global”的访问被拒绝。
  说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

 异常详细信息: System.UnauthorizedAccessException: 对注册表项“Global”的访问被拒绝。

ASP.NET 无权访问所请求的资源。请考虑对 ASP.NET 请求标识授予访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 和 IIS 7 上为网络服务,在 IIS 7.5 上为配置的应用程序池标识)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

源错误:

 

[没有相关的源行]
 

源文件:  c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\web\5c384cf9\46b77c0f\App_Web_nm3ffvud.0.cs    行:  0

堆栈跟踪:

 

[UnauthorizedAccessException: 对注册表项“Global”的访问被拒绝。]
   Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +6504925
   Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity) +361
   Microsoft.Win32.RegistryKey.GetValue(String name) +62
   System.Diagnostics.PerformanceMonitor.GetData(String item) +148
   System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item) +255
   System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +172
   System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists) +35
   System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter) +95
   System.Diagnostics.PerformanceCounter.InitializeImpl() +392
   System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly) +373
   System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName) +14
   Monitor_ServersState..ctor() +215
   ASP.monitor_serversstate_aspx..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\web\5c384cf9\46b77c0f\App_Web_nm3ffvud.0.cs:0
   __ASP.FastObjectFactory_app_web_nm3ffvud.Create_ASP_monitor_serversstate_aspx() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\web\5c384cf9\46b77c0f\App_Web_nm3ffvud.1.cs:0
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +174
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +42
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +549
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +208
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

 


--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.17929

baoerzhang | 园豆:86 (初学一级) | 2014-03-11 10:47

@baoerzhang: 你看啊,除了 NetworkService,是不是还有 LocalSystem,LocalService,你都试试,不行的话,还可以试试自己输入帐户好密码,最好是管理员。

如果还不行,那么还是设置为 NetworkService,然后打开注册表,找到 Global 项,点右键,选择权限,把 NetworkService 加到列表中去,设置只读权限。

Launcher | 园豆:45045 (高人七级) | 2014-03-11 10:53

@Launcher: 哎呀大哥,可以了,按照你说的把应用程序池的标识从 ApplicationPoolIdentity 修改为 NetworkService了,但是必须把之前webconfig<identity impersonate="true"/>才行。现在已经没问题了,太感谢了。顺便多问一句,我上个问题也是你解决的,您都是从哪看的这些知识啊。

baoerzhang | 园豆:86 (初学一级) | 2014-03-11 13:02

@baoerzhang: 网上搜索的,然后综合起来分析。

Launcher | 园豆:45045 (高人七级) | 2014-03-11 13:11

@Launcher: 大牛在吗?我又提了一个新问题,你看你又遇见过吗,帮忙看下吧,谢谢啦

http://q.cnblogs.com/q/61864/

baoerzhang | 园豆:86 (初学一级) | 2014-05-03 19:09
其他回答(1)
0

直接改成LocalSystem, 我的就可以了

grj001 | 园豆:202 (菜鸟二级) | 2021-04-17 10:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册