C # System. Diagnostics. Process. GetProcessesByName (String processName)

Source: Internet
Author: User
Sometimes when we use EXCEL to Process data and finally kill the EXCEL Process, the System. Diagnostics. Process. GetProcessesByName (String processName) method will report an error,

Access rejected.

Description:Exceptions that are not handled in the current Web requirements of the primary row. Please refer to the heap tracing to obtain the dynamic metadata and production location in the program.

Exception:System. ComponentModel. Win32Exception: Access denied.

Original program example:

During the current Web Request period, exceptions cannot be processed. If you need to obtain the source and location information from the exception tracing service, you can use the following exceptions to obtain them from the heap Tracing Service.

Heap tracing:

[Win32Exception (0x80004005): Access denied.] System. diagnostics. performanceMonitor. getData (String item) + 485 System. diagnostics. performanceCounterLib. getPerformanceData (String item) + 158 System. diagnostics. performanceCounterLib. get_CategoryTable () + 80 System. diagnostics. performanceCounterLib. getPerformanceData (String [] categories, Int32 [] categoryIndexes) + 56 System. diagnostics. ntProcessManager. getProcessInfos (PerformanceCounterLib library) + 157 [InvalidOperationException: unable to obtain the processing order information from the local computer.] System. diagnostics. ntProcessManager. getProcessInfos (PerformanceCounterLib library) + 258 System. diagnostics. ntProcessManager. getProcessInfos (String machineName, Boolean isRemoteMachine) + 153 System. diagnostics. processManager. getProcessInfos (String machineName) + 37 System. diagnostics. process. getProcessesByName (String processName, String machineName) + 69 System. diagnostics. process. getProcessesByName (String processName) + 11 SchedulingWL. DPS. dataMaintainAV. showExcel1 () in d: \ web \ wl_scheduling \ dps \ datamaintainav. aspx. cs: 676 SchedulingWL. DPS. dataMaintainAV. btnExcel_Click (Object sender, ImageClickEventArgs e) in d: \ web \ wl_scheduling \ dps \ datamaintainav. aspx. cs: 535 System. web. UI. webControls. imageButton. onClick (ImageClickEventArgs e) + 109 System. web. UI. webControls. imageButton. system. web. UI. IPostBackEventHandler. raisePostBackEvent (String eventArgument) + 69 System. web. UI. page. raisePostBackEvent (IPostBackEventHandler sourceControl, String eventArgument) + 18 System. web. UI. page. raisePostBackEvent (NameValueCollection postData) + 33 System. web. UI. page. processRequestMain () + 1292

Solution:
1. Use WEBCONFIG
<Identity impersonate = "true" userName = "User" password = "ABCDE"/>
In the <system. web> label
2. Set ASP. NET as Administrator (IIS5 and below) or NETWORKSERVICE (IIS6)

Version Information:Microsoft. NET Framework Version: 1.1.4322.2300; ASP. NET version: 1.1.4322.2300
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.