none
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID

    Question

  • Hi,

    Trying to create a Excel file using ASP.Net application.

    The deployment environment instead of Microsoft office ,Office PIA is installed.

    But still getting the following Interop error.

    I am not allowed to install Microsoft office in the deployment enviornment, is there a workaround.

    Thanks & Regards

    Para

    Tuesday, July 09, 2013 2:15 PM

Answers

  • Hi Para

    The Office Open XML file formats and the Open XML SDK are not "open source".

    The Office Open XML file formats are the *.docx, *.xlsx, etc. files. These files are zip packages (archives) of xml and other files that, together, make up the Office document. These are the files that the Office applications (since version 2007) generate and users work with. These file formats were designed specifically by Microsoft with server-side generation and manipulation of Office documents in mind.

    The Open XML SDK is a Microsoft Visual Studio .NET tool for working with these Zip packages. You don't need to use the SDK; you can do the work using the System.Packaging and standard XML namespaces to work with the Zip packages. The SDK just makes this "simpler". You might want to browse OpenXMLDeveloper.org to get more information on the topic before turning it down out-of-hand.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 19, 2013 1:12 PM
  • Firstly, what is the relevant snippet of your code that raises that error?

    Secondly, no Office app (Excel included) can be used in a service (such as IIS). If all you need is create an Excel file, take a look at EPPlus (http://epplus.codeplex.com/): open source and can be used in a service.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, July 09, 2013 6:12 PM
  • If I not mistaken, EPPlus is distributed under the LGPL license, so you are not really limited in any way..

    You can of course write your own library that creates Excel files...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Tuesday, July 09, 2013 9:48 PM
  • Hi Para de,

    Thank you for posting in the MSDN Forum.

    Sever side automation is not supported and not recommended, you might want to read Considerations for server-side Automation of Office.

    You can use OpenXML SDK to generate document instead.

    Hope it helps.

    Best regards, 


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 10, 2013 6:11 AM

All replies

  • Firstly, what is the relevant snippet of your code that raises that error?

    Secondly, no Office app (Excel included) can be used in a service (such as IIS). If all you need is create an Excel file, take a look at EPPlus (http://epplus.codeplex.com/): open source and can be used in a service.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, July 09, 2013 6:12 PM
  • Hi,

    System is throwing an exception while initializing 

     Excel.Application objXL;
                Excel.Workbook objWB;
                Excel.Worksheet objSheet;
                Excel.Range objRange;

    I am not allowed to use any open source.

    Thanks 

    Para


    Tuesday, July 09, 2013 6:51 PM
  • If I not mistaken, EPPlus is distributed under the LGPL license, so you are not really limited in any way..

    You can of course write your own library that creates Excel files...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Tuesday, July 09, 2013 9:48 PM
  • Hi Para de,

    Thank you for posting in the MSDN Forum.

    Sever side automation is not supported and not recommended, you might want to read Considerations for server-side Automation of Office.

    You can use OpenXML SDK to generate document instead.

    Hope it helps.

    Best regards, 


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 10, 2013 6:11 AM
  • Thank you very much for the response,but open source is not allowed in this environment.

    Can you please help me resolving the following issue.

    Currently the Web app is working fine in Windows 7 (OS) 32 Bit.

    But after hosting the Web app in the Windows 8 server 64 bit machine (with Microsoft Office 2010)

    Also made following changes to DCOM Config :

    Go to Security and select "Customize" under "Configuration Permissions. (If needed you might want to change the other permissions as well, but I didn't need to) Add "IIS_IUSRS" and give it "Full Control".Now go to "Identity" and select "The interactive user".

    Still getting the following error:System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

    Please help.

    Thanks 

    Para

    Thursday, July 18, 2013 9:36 PM
  • Hi Para

    The Office Open XML file formats and the Open XML SDK are not "open source".

    The Office Open XML file formats are the *.docx, *.xlsx, etc. files. These files are zip packages (archives) of xml and other files that, together, make up the Office document. These are the files that the Office applications (since version 2007) generate and users work with. These file formats were designed specifically by Microsoft with server-side generation and manipulation of Office documents in mind.

    The Open XML SDK is a Microsoft Visual Studio .NET tool for working with these Zip packages. You don't need to use the SDK; you can do the work using the System.Packaging and standard XML namespaces to work with the Zip packages. The SDK just makes this "simpler". You might want to browse OpenXMLDeveloper.org to get more information on the topic before turning it down out-of-hand.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 19, 2013 1:12 PM
  • Once again, you cannot use any Office apps in a service...

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, July 22, 2013 5:20 PM
  • Thanks for the help , I have also checked Openxml which is working at server.

    But this is a deployment environment so I am not allowed to make any code change, is there any way to resolve this by  changing the configuration or setting permission.

    Thanks

    Monday, July 22, 2013 8:57 PM