Munish Goyal
Munish Goyal

Reputation: 1409

MS Office PIA Com Interop Error

My app reads an excel file to parse and upload records. I use .NET 4 and PIA.
The app runs fine on my Win7 machine. But on Win2003 server it is giving this error on below code line

var xlApp = new Microsoft.Office.Interop.Excel.Application(); 

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.

Please give some pointers to solve this.

Upvotes: 0

Views: 177

Answers (1)

Hans Passant
Hans Passant

Reputation: 942438

The very first thing you have to do is to make sure that Office is actually installed on that server. You can't use a PIA without the component being present.

Second thing you have to do is worry about the bitness of your process. A server is likely to boot the 64-bit version of Windows but have the 32-bit version of Office installed. Which means that your process needs to be 32-bit as well. Project + Properties, Build tab, change the Platform target setting from AnyCPU to x86. If this code runs in IIS then enable 32-bit application pool support.

Upvotes: 1

Related Questions