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

2

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);
c#
.net-framework-version
comexception
visio2013
visio-2010
asked on Stack Overflow Apr 27, 2017 by Puneeth

1 Answer

2

"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".

answered on Stack Overflow Apr 27, 2017 by Koby Douek

User contributions licensed under CC BY-SA 3.0