A
Akbur
Dear all,
I have developed a method in C# which creates an instance of Word, adda a
document, then populates the Word doc with some text. It then saves it,
closes the doc and quits Word.
Now this is the problem: The method works perfectly on the command line and
through IE on my development machine (Win XP Pro, Office 2003) but it fails
to work on the server (Windows 2000 Advanced Server, Office 2000) when called
through IE (it works fine through the command line even on the server!) I
can see (using ProcessExplorer) that the instance of Word is being created
and is sub-process of svchost.exe and that the actual Word doc is also being
created on the hard disk. However, the Word process still has a lock on the
doc. Through further analysis and logging, I believe it is falling down when
I try to save the document using:
aDoc.SaveAs(ref filetosave, ref missing, ref missing, ref missing, ref
missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing);
The SaveAs method is not passing control back to my method which explains
why the generated Word doc is still locked and it is therefore halting the
overall execution. When we do run the interop code and we kill the hanging
Word process ourselves (using ProcessExplorer) we get the following exception
in EventViewer:
System.Runtime.InteropServices.COMException (0x800706BE): The remote
procedure call failed.
Does any one know of any issues that could be causing this behaviour? I
don't think its an IIS specific issue because when I by-pass IIS and use my
own web server (which is much much simpler) it still causes the same effect
of hanging.
Any advice would be appreciated!
Cheers,
Akbur
I have developed a method in C# which creates an instance of Word, adda a
document, then populates the Word doc with some text. It then saves it,
closes the doc and quits Word.
Now this is the problem: The method works perfectly on the command line and
through IE on my development machine (Win XP Pro, Office 2003) but it fails
to work on the server (Windows 2000 Advanced Server, Office 2000) when called
through IE (it works fine through the command line even on the server!) I
can see (using ProcessExplorer) that the instance of Word is being created
and is sub-process of svchost.exe and that the actual Word doc is also being
created on the hard disk. However, the Word process still has a lock on the
doc. Through further analysis and logging, I believe it is falling down when
I try to save the document using:
aDoc.SaveAs(ref filetosave, ref missing, ref missing, ref missing, ref
missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing);
The SaveAs method is not passing control back to my method which explains
why the generated Word doc is still locked and it is therefore halting the
overall execution. When we do run the interop code and we kill the hanging
Word process ourselves (using ProcessExplorer) we get the following exception
in EventViewer:
System.Runtime.InteropServices.COMException (0x800706BE): The remote
procedure call failed.
Does any one know of any issues that could be causing this behaviour? I
don't think its an IIS specific issue because when I by-pass IIS and use my
own web server (which is much much simpler) it still causes the same effect
of hanging.
Any advice would be appreciated!
Cheers,
Akbur