The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

家住魔仙堡 提交于 2019-12-12 17:20:32

问题


I have an application which opens an Visio file .VSD and copies some jpeg images onto the VSD file. I am using Visio 2013, it works fine with this version but I have another client machine where I have only exe of this application(not complete code base) and has Visio 2010 in that client machine. when I run the application and select the Visio .vsd file, it throw the above subjected error.

Struggling to understand whether problem with exe, code, version or dlls? May I know what could be the fix or some workaround? My code to open the visio application that's where the exception is thrown is below,

 Microsoft.Office.Interop.Visio.Application application = new Microsoft.Office.Interop.Visio.Application();
 application.Visible = true;

                                     Microsoft.Office.Interop.Visio.Document doc = null;
                 OpenFileDialog filedg = new OpenFileDialog();
                 filedg.Title = "Select VSD template file";
                 filedg.InitialDirectory = @"c:\";
                 filedg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
                 filedg.FilterIndex = 2;
                 filedg.RestoreDirectory = true;
                 if (filedg.ShowDialog() == DialogResult.OK)
                 {
                     LogMessageToFile("Opening Visio template");
                     if(application == null)
                     {
                         LogMessageToFile("Visio application is NULL");
                         return;
                     }
                     LogMessageToFile("Filename" + filedg.FileName);
                     doc = application.Documents.Open(filedg.FileName);

回答1:


"it works fine with this version but I have another client machine where I have only exe of this application" -

From my experience, if this happens only on several computers, the problem is that the EXE you are running has insufficiant priviligaes to use InterOp or Visio itself.

Try running the EXE with "Run as administrator".



来源:https://stackoverflow.com/questions/43648735/the-server-threw-an-exception-exception-from-hresult-0x80010105-rpc-e-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!