Everything works fine localy, but when deployed on the server, I always get the following error :
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
So I checked this : Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
But so far it did not solve the issue, what I tried :
- Putting target platform to 86x in project setting
- Check the "autorize unsafe code" box in project setting
- Enable 32bit app in advanced setting of iis app pool
I'm through with this, here's an exemple of how it's coded :
Word.Application wordApp = new Word.Application();
myWordDoc = wordApp.Documents.Open(ref NomFichier, ref missing, ref readOnly,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
myWordDoc.Activate();
// Other operations
myWordDoc.SaveAs2(ref EnregistrerComme, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
myWordDoc.Close();
wordApp.Quit();
My guess is : There has to be something wrong with iis since it work localy (but I wouldn't bet on it)...