两个问题-RPC服务器不可用异常,任务管理器中的Excel.exe [英] Two Problems - RPC server unavailable exception , Excel.exe in Task manager
问题描述
大家好,
我面临任务管理器中的两个问题RPC不可用异常,Excel.exe
对于我的Windows应用程序,我需要复制一个excel模板文件并将其重命名为``今天的日期''文件.然后像excelApp.Quit()一样关闭内容,并保存excel工作表.
Excel.exe
但是,任务管理器中仍然存在Excel.exe.为什么?如何避免?
我已正确关闭excel应用程序.
RPC服务器不可用异常
我将模板文件复制为今天的日期文件.
当我尝试打开今天的日期"文件异常时,就像RPC不可用异常一样.为什么?如何解决?
Hi Everybody,
I m facing the two problems RPC unavailable exception , Excel.exe in Task manager
For my windows application i need to copy a template excel file and rename as Today''s Date file.Then write the contents , close like excelApp.Quit() , saves the excel sheets also.
Excel.exe
But still the Excel.exe is exists in Task manager. Why? How to avoid?
I closed the excel application properly.
RPC server unavailable exception
I copied the template file as Today''s date file.
when I try to open the Today''s date file exception as occurring like RPC unavailable exception. Why? How to solve?
wbApp = excelApp.Workbooks.Open(fileName, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
wsApp = (Microsoft.Office.Interop.Excel.Worksheet)wbApp.Sheets[1];
请帮助我
在此先感谢
注意-我正在使用C#、. Net
和2003 MS office
please help me
Thanks in advance
Note - I am using C#, .Net
and 2003 MS office
推荐答案
我不知道如何解决任务栏问题,也许会有其他人解决.
对于RPC错误,请查看此 [
I do not know how to help with the Task bar issue, perhaps someone else will have a solution.
For the RPC error, take a look at this[^] thread on MSDN also concerning Office 2003. (Scroll down to the second last answer).
关于第一个问题,您必须释放所有已创建COM对象.
这是一个很好的提示,当您使用COM对象时,请不要使用两个点!
像这样:
不要这样写:application.Workbooks.Open(filename)
这样写:
About the first problem you have to free all of the COM objects created.
It''s a goot tip that when you using COM objects, don''t use two dots!
Like this:
Do not write this:application.Workbooks.Open(filename)
Write this:
workbooks = application.Workbooks;
workbook = workbooks.Open(filename);
然后最后必须通过以下代码释放两个拖曳对象:
then at the end you have to free that tow objects by following code:
workbook.Close();
Marshal.ReleaseComObject(workbooks);
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(application);
application.Quit();
这篇关于两个问题-RPC服务器不可用异常,任务管理器中的Excel.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!