Documents.Open returns null value
-
Wednesday, December 17, 2008 5:04 PMHello,
as posted here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4068795&SiteID=1 (but that's the wrong forum I guess) I have a problem opening Word document.
On my development machine (win XP, Office 2007) it works as expected.
In a previous project which was deployed to a Win2003 machine with Office 2003 installed, it also worked.
In the current project (ASP.NET) hosted in Win2008 with office 2007 installed, it stopped working.
What I try to do is launch a Word session and open an existing document. The code is as follows:
// create a new word applicationWordInterop.
ApplicationClass wordApp = null;WordInterop.
_Document wordDocument = null; wordApp = new WordInterop.ApplicationClass();wordApp.Visible =
false;wordDocument = wordApp.Documents.Open(ref wordTemplatePath, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing, ref visible, ref wordMissing, ref wordMissing, ref wordMissing, ref wordMissing);
I'm not getting any exceptions any more, just a null value from the Documents.Open function.
I've eliminated all COM exceptions by setting the correct permissions. The app is running as a local user in IIS (I double checked / verified that) which is also part of the Administrators group on that machine. I've included the account to have enough rights to start the COM component. I also checked the settings for the launching/interactive/specific user and even tried all of them: doesn't change one thing.
I also tried opening a remote session for the user which is running the actual application pool. After logging in I can open Word and load the document without any problems.
No error, but no document either... what to do next
MCTS in Web Application Development in .NET 2.0
All Replies
-
Wednesday, December 17, 2008 5:12 PMI'm afraid the link you post doesn't go anywhere. I don't get an error message, just a skeleton for the old forum interface with no message content.
FWIW this is not the correct forum. VSTO is a particular technology that runs in-process with Office applications; general "interop" or "automation" is not supported here. The Please Read First message outlines what VSTO is, what the forum supports, and provides links to places where you can ask non-VSTO, Office-related questions.
Cindy Meister, VSTO/Word MVP -
Friday, December 19, 2008 3:11 PMYour link doesn't work either, so I guess that makes two of us :)
MCTS in Web Application Development in .NET 2.0 -
Friday, January 14, 2011 2:30 PM
-
Friday, June 22, 2012 8:54 AM
Win7 offis 2010 için
- DCOM
- DCOM Config ayarlarına girin (windows\System32\comexp.msc) ve Microsoft Office Word’e (veya hangi program kullanılmak isteniyorsa) sağ tıklayıp özellikleràkimlikà Etkileşimli kullanıcı (interaktive User)
- Güvenlik sekmesinden başlatma ve etkinleştirme izinlerià düzenle IIS_IUSRS ‘ye uzaktan erişim haklarını ver.
- IIS üzerindeki uygulamaya sağ tıklayıp “izinleri düzenle” kısmından herhangi bir admin kullanıcı ekle.
- Ayrıca offisi işlemleriniz bittiğinde kapatabilmek için uygulama havuzunuzun kullanıcı kimlliğinizi admin grubundan seçmelisiniz.
- DCOM
-
Friday, June 22, 2012 9:04 AMThanks. That's probably real usefull when you speak the language :S
MCTS Web Application Development, SharePoint enthousiast.

