Today I encountered a problem: I called the Excel COM component in a web program.
Result After each call, the task manager generates an Excel. EXE process.
This can cause fatal memory and CPU usage.
Then I want to close the process or release resources.
Two methods have been tried successively (after the Excel operation ):
1. process. Kill ();
2. gc. Collect ();
Method 1: The system throws an exception and prompts: access is denied.
The second method does not change after execution. The Excel. EXE process in the task manager is still in
Then, we made a Google tour.
The query finds that most of the two methods are available on the Internet.
Also, add authentication in the configuration file (I did not try)
No result after searching for a while !!
Then delete the above two methods,
Try not to kill or release resources in the Excel Operation Method
After the Excel method is called, for example, bool ret = doexcel ();
Followed by GC. Collect ();
In this case, check the result ---- surprise!
After the Excel. EXE process is released successfully, it is automatically disabled.
[The above is what I encountered below win7. I don't know if this is the case for other server systems]
I wish you a 5.1 happiness.