We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

COM Exception while reading Visio Diagram

Hi,


I’m trying to export Visio files to images and I get the following exception

Exception Details: System.Runtime.InteropServices.COMException:
at the line :
Diagram MSCdiagram = new Diagram(filename);

I’m running this on Windows Server 2008, .NET 4.0 based on the Model View Controller architecture. I’ve installed Aspose.Diagram and referred to it appropriately. The stack trace is as follows:
 Microsoft.Office.Interop.Visio.DocumentsClass.Open(String FileName) +0
WebEbdMvcFinal.Controllers.FileUploadController.Upload(HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3, String ProjName, Boolean checkAuto) in C:\inetpub\wwwroot\EBDWebsite\Controllers\FileUploadController.cs:833
lambda_method(Closure , ControllerBase , Object[] ) +333
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +260
System.Web.Mvc.Async.<>c__DisplayClass42.b__41() +40
System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +129
System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +882007
System.Web.Mvc.Async.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass2a.b__20() +33
System.Web.Mvc.Async.<>c__DisplayClass25.b__22(IAsyncResult asyncResult) +882588
System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +53
System.Web.Mvc.<>c__DisplayClassb.b__4(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.Mvc.<>c__DisplayClasse.b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
From this, I’m guessing I’m not able to open Visio. But, I have Visio 2010 installed on the server. However I’m not able to find it in the DCOM configuration in order to allow local launch on the server.

Hi Ananth,


Thanks for your inquiry. Could you please share the problematic Visio diagram here in this thread? We will take a closer look and guide you accordingly. It helps to replicate the error message on our side. We’re sorry for your inconvenience.

Hi,

Thanks for the reply. The file is at https://docs.google.com/file/d/0B55jjlGWWrjvLVVFeXpEVm5BNG8/edit?usp=sharing. However, I don’t think the file is a problem. Because when I debug the website using Visual Studio, the exception does not come up. Is there something I need to do to allow access when its running on the server?

Hi Ananth,


Thanks for the information. You are right that there is no error message while debugging. You do not need to install MS Visio 2010 on the server because Aspose.Diagram component allows you to modify, convert and manipulate Visio diagrams without MS Visio. Please confirm that you are using the latest version of Aspose.Diagram 5.5.0. It seems like another application has your file open and therefore has a lock on it. Please take care of the following points:

  1. You don’t have the document open in Visio when you are running your program.
  2. Check the account permissions by which the Windows Service logs on. Make sure there are no permission issues.
  3. Try to verify which process has a hold on the file.

I hope it helps. Please let me know in case of further assistance or questions.

We’re looking forward to help you.

Thanks. It’s resolved now. I think I had an unresponsive Visio running in the background, which had a lock on this file.


Now, I’m trying to export this diagram to images (jpg and png format). But, Diagram.Pages.Count is returning 1, whereas there are 3 pages in this particular document. Also, the first page that is getting exported, is missing many data flow lines of the diagram. Is this a known issue?

The code.
for (i = 0; i < MSCdiagram.Pages.Count; i++)
{
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG);
options.PageIndex = i;
FinalDest = Folder + “Msc_” + p.UserName + “" + ProjName + "” + i +".jpg";
MSCdiagram.Save(FinalDest, options);
}

Hi Ananth,

Thank you for your inquiry. It is because you did not apply a license. Can you see an evaluation mark in your output image file?. You will not see this mark when the product will be licensed. There are some evaluation limitations. We have a list of limitations here as only first 10 shapes are read, only one page is read. Please see documentation on

Please try it with the latest version of Aspose.Diagram for .NET 3.3.0 because I did not observe any problem. You can avoid evaluation limitations by getting a temporary license for 30 days and visit download page here: http://www.aspose.com/community/files/51/.net-components/aspose.diagram-for-.net/default.aspx

You can learn all about how Aspose products are licensed by checking out the Licenses FAQ here: http://www.aspose.com/corporate/purchase/faqs/default.aspx

Please let me know in case of further assistance or questions.