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