Last post Aug 06, 2009 05:43 AM by hundehasser
Jul 17, 2007 05:03 PM|eanda9000|LINK
Our .Net 2.0 application works fine on XP. When we deploy to testing, WS2003 with .Net 2.0 and Word 2007, the program hangs indefinitely when word attempts to open a file. The suspect code is below. It would be nice if we were getting an exception but
we are not so lucky I guess.
We have the following code:
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim oMissing As Object = System.Reflection.Missing.Value
Dim oFalse As Object = False
Dim oTrue As Object = True
' Create an instance of Word
wrdApp = New Word.Application()
wrdApp.Visible = False
' Open the template document.
Dim oFile As Object = Server.MapPath("~/proposal2/WordTemplate/Boiler Plate Cover Letter.doc")
' hangs at the next line
wrdDoc = wrdApp.Documents.Open(oFile, oMissing, oFalse, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing)
.Net has access to the file so it does not seem like a file access permissions thing.
Any ideas are appreciated.
Sep 25, 2007 07:59 AM|hundehasser|LINK
Have you solved this problem yet?
We 're facing the same situation with Excel.WorkBooks.Open(): The Excel application starts but hangs forever trying to open the file.
However, we found a way to get the WorkBook to open, but that requires every user (we use impersonation) to log into the server machine, start Excel and invoke the Visual Basic Editor once (using Alt+F11). Unfortunately that is not an option in our production
Thanks and best regards,
Sep 27, 2007 01:10 PM|dpcolgan|LINK
Exact same problem here... any ideas ?
Sep 28, 2007 04:18 AM|hundehasser|LINK
We now start Office under a distinct user account as described in
How to configure Office applications to run under a specific user account. It works for the moment, but has serious side effects:
Microsoft gives another way that would not need to run Office as admin in
How to configure Office applications to run under the interactive user account (our desired behaviour), but all we get is "0x8000401A: The server process could not be started because the configured identity is incorrect. Check the username and password."
We do use impersonation, of course. Has someone got it working?
Aug 06, 2009 04:11 AM|velaspnet|LINK
I facing the same problem while opening the excel file to a workbook object. The code works fine in my development environment( win xp) but hangs in production environment(win server 2003). That too it hangs only if the excel file contain some excel objects
like listbox,buttons otherwise it works fine
.net excel open problem
Aug 06, 2009 05:43 AM|hundehasser|LINK
That looks VBA-ish: Have you manually invoked the VBA editor on the server at least once (under the same account ASP.Net will use later)? That could solve the hanging,
but Office performance on the web server will be just horrible (for Office was not designed to work in a multi user environment).
So we refrained from using Office InterOp at all. Instead we used OleDocumentProperties to pass server side information to some auto-starting Excel macros and let them do all the work, e.g. pulling data into work sheets using the connection
settings provided via OleDocumentProperties by Asp.Net.
Just have a look at Microsoft's DsoFile.dll (comes with source code and .Net InterOp wrappers):
The Dsofile.dll files lets you edit Office document properties when you do not have Office installed [sic].
HTH and best regards,