关于网友提出的“ IIS下无法结束EXCEL进程”问题疑问,本网通过在网上对“ IIS下无法结束EXCEL进程”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: IIS下无法结束EXCEL进程描述:
小弟在一个项目中将数据导出为EXCEL文件,并调用KillSpecialExcel方法关闭EXCEL进程,但总是报如下错误:access is denied,小弟的项目是部署到IIS6.0中的,在项目中直接运行是可以关闭的,在IIS下却老是报上面的错误,在网上也找不到相关的资料,我怀疑是权限问题,但该添加的账户我都添加了,还是不行,不知道是什么问题,请各位高手指教,谢谢!
static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);
{
{
GetWindowThreadProcessId(new IntPtr(m_objExcel.Hwnd), out lpdwProcessId);
System.Diagnostics.Process.GetProcessById(lpdwProcessId).Kill();
解决方案1:
帮顶、、、
解决方案2:解决方案3:
xBk.Close(false, null, null);
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xBk);
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xSt);
xBk = null;excel = null;
xSt = null;GC.Collect();
/>
good 解决方案4:
你启动的excel的时候把权限设置成everyone
解决方案5:怀疑是权限问题就把站点的application pool用administrastor运行,如果不行那就不是权限问题了。
解决方案6: xlApp.Workbooks.Close();<>
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
ws = null;