当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 在Window2003上执行System.Diagnostics.Process.GetProcessesByName等方法失败的原因

ASP.NET
运行时修改Web.config中的元素值
优秀的Architect之路(入门)
提问的智慧(HowToAskQuestionsTheSmartWay)
C#数据结构篇(3队列类)
现在就可下载WTL7.0和.NETSP1
在.NET中开发组件
使用.NET远程处理访问其他应用程序域中的对象
使用ADO.NET访问数据库
承载.NET公共语言运行库
在.NET运行时了解类型信息(2)
在.NET运行时了解类型信息(3)
智能客户端(SmartClient)
获取数据库表结构
Visual Studio 2005 分包下载
为DataGrid中的行增加序号
关于HttpContext的Items属性
[推荐].NET XML Best Practices - Choosing an XML API
在 XML Schema和WSDL中使用名称空间
在论坛里为什么不能发问题
AspectSharp例子分析

ASP.NET 中的 在Window2003上执行System.Diagnostics.Process.GetProcessesByName等方法失败的原因


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 78 ::
收藏到网摘: n/a

在Windows2003上执行 System.Diagnostics.Process.GetProcessesByName等方法会报出Exception:
Couldn't get process information from remote machine.

这个错误的原因是: 获取Process与Performance Counter相关, 当前的执行用户不是Administrator 组成员
MSDN的解释:1.Performance information is not available to a non-admin account, which is not in the Performance Counter Users Group on Windows Server 2003. So the Process class could not get process performance information in this case.

2.Getting performance data from all the processes on the machine is pretty expensive. The operating system (OS) might load lots of DLLs and it might take seconds to complete. The floppy drive light will be on when the OS tries to find the index for some performance counter.
3.f the performance counter data was corrupted for any reason, the Process class could throw an exception while trying to convert some raw performance information into DateTime.

4.The Process class could not be used to get process information on machines without the process performance counter. Performance counters can be disabled in Windows. See the following link for details: http://www.microsoft.com/windows2000/techinfo/reskit/en-us/default.asp?url=/windows2000/techinfo/ reskit/en-us/regentry/94214.asp

The good news is that we have changed the implementation of the Process class in Visual Studio 2005 (our next release, code-named Whidbey). The Process class doesn't have a dependency on performance counter information any more (this is only true for local processes).

相关链接:
http://msdn.microsoft.com/netframework/programming/bcl/faq/SystemDiagnosticsProcessFAQ.aspx