0
votes

When I try to create oXL object, I add the Interop Excel references but not working.

object missing = Type.Missing;
Range aRange;
Microsoft.Office.Interop.Excel.Application oXL = new Microsoft.Office.Interop.Excel.Application();
oXL.Visible = false;

I got this error:

No se pudo recuperar el generador de clases COM para el componente con CLSID {00024500-0000-0000-C000-000000000046} debido al siguiente error: 80070005 Acceso denegado. (Excepción de HRESULT: 0x80070005 (E_ACCESSDENIED)).

English translation:

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

1
Translate pls your error to English..Artem Kulikov
Office interop from IIS is a bad idea, see stackoverflow.com/questions/3359864/…Alex K.
It was problem with IIS and now works perfectly. Thanks for the help.Gme Moreno

1 Answers

1
votes

Do you have Office installed on the server?
or
Do you have PIAs installed on the server?

That said; here is comes the mandatory don't do:

Installing Office on the server is considered a bad solution. If you really need to, I suggest you install Office on its own server to call from your IIS.

Interacting with Office on the client is cumbersome, to say the least. Code examples are often naïve. If you still need to - wrap all office interaction.

Finally - if you only need to export excel files, look into the open source libs that are out there. I have used EPPlus which was both faster and less error prone than the original solution that talked to Excel.

Finally finally you can reverse engineer the excel format and generate the file through stringing together xml. I have done this too and it was lightning fast. My first try was to use an XML DOM and it worked perfectly until we ran out of RAM; then we stringed the XML together.

YMMV