[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 799
  • Last Modified:

System.InvalidCastException: QueryInterface for interface Excel._Application failed.

This one has me stumped, hopefully not for much longer.  Here is the situation:  A .NET web application pulls data into a sql data reader , then creates, populates, and saves an Excel File.  This error is being thrown when the application runs on the server.  This error does not occur when it is in the debugger.  I even created a modified version of the program to run on my development box (release version) and ran it with no problems.  So it looks like the object cannot be created on the server Windows 2000 for some reason, here is the kicker: It has been working fine for about two years and suddenly broke.  Any ideas?

Thanks in advance-
0
ndegioia
Asked:
ndegioia
  • 2
  • 2
1 Solution
 
existenz2Commented:
Is Excel installed on the server?

This is required for creating Excel files and are the Excel versions the same?
0
 
ndegioiaAuthor Commented:
Yes MS Office 2002 is installed on the server.  The applicaiton is using the Microsoft.Office.Core object Library 11.0.  The Execl version on my dev box is 2003.  Do you think the object library needs to be for 2002; possibly Microsoft.Office.Core object Library 10.0?  Is there a way it can work with both?

Thanks
0
 
existenz2Commented:
That is definatly the problem. I would install Excel 2003 on the server to upgrade it and not downgrade your code to work with 2002.
0
 
ndegioiaAuthor Commented:
Thanks, I will give that a try.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now