Click here to Skip to main content
15,887,311 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

We are trying to convert word document to PDF and able to do the same on staging server with Microsoft office 2007 professional setup using
ExportAsFixedFormat
method from
Microsoft.Office.Interop.Word.Document 
from below code :

wordDocument.ExportAsFixedFormat(paramExportFilePath,
                            paramExportFormat, paramOpenAfterExport,
                            paramExportOptimizeFor, paramExportRange, paramStartPage,
                            paramEndPage, paramExportItem, paramIncludeDocProps,
                            paramKeepIRM, paramCreateBookmarks, paramDocStructureTags,
                            paramBitmapMissingFonts, paramUseISO19005_1,
                            ref paramMissing);


However it is not working on production server with Microsoft Office 2013 standard edition and gives below error upon running from IIS :

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).


I am not sure if this is due to office setup difference or we need to add any add-in ?

We have tried giving rights to DCOM config as well.

Please assist.


Thanks in advance.

What I have tried:

We have tried giving rights to DCOM config 
Posted
Updated 29-May-18 11:50am

1 solution

You should not be using the Office Interops in this way, MS does not support their use as part of a web site & they are not recommended, refer;
Considerations for server-side Automation of Office[^]
Refer specifically to the section Problems using server-side Automation of Office as this clearly describes why you are having issues, specifically regarding User Identity, your website is likely running under an account that does not have a user profile, hence office will not work correctly. Working around this is possible but not the correct answer

Kind Regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900