Here’s my small bit of code.
protected void ViewVisio(string url)
{
// open document
Microsoft.Office.Interop.Visio.Application visApp =
new Microsoft.Office.Interop.Visio.Application();
Microsoft.Office.Interop.Visio.Document visDoc = // application hangs here
visApp.Documents.Open(url);
...
}
Basically, the application just hangs forever on the line that opens the document. It never times out, even after a few hours, and it never throws an exception. I checked the Windows event logs, and there’s nothing there.
I have Office installed on my server with all the correct permissions. I’m doing the same thing with Word, Excel, and PowerPoint files and they all work just fine, so I don’t think it has anything to do with that.
So I’m at a bit of a loss here – anyone know what the issue could be?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Never run Microsoft Office under an automation context. Microsoft does not recommend or support this (see KB257757 here).
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0