_Application = new NetOffice.ExcelApi.Application() throws exception 80010108 on Server 2K3 but not XP

Aug 26, 2011 at 8:22 PM
Edited Aug 26, 2011 at 8:26 PM

I have been having success with an application which uses NetOffice (kudos for your work, it's been a breeze working with it!) on my dev machine. (WinXP SP3 with MS Office 2000)

 

Today I finally deployed it to our Windows Server 2003 machine for testing in a production environment, and it is throwing an exception as soon as I attempt to create an instance of the NetOffice.ExcelApi.Application object.

(The server it is failing on is the domain controller of our domain, but I am testing the program as the domain administrator account so I don't think it is a permissions issue...)

I have referenced the following assemblies in the project:

ExcelApi.dll

LateBindingApi.Core.dll

OfficeApi.dll

VBIDEApi.dll

Here is a code snippet which produces the error on our Windows Server 2003 (w/Microsoft Office 2000) but which is working flawlessly on my Windows XP SP3 (w/Microsoft Office 2000) system:

 

 

using Excel = NetOffice.ExcelApi;

public Excel.Application ExcelApplication
{
	get { return _ExcelApplication; }
}
Excel.Application _ExcelApplication;

public void LoadExcel()
{
	// Initialize Api COMObject Support
	LateBindingApi.Core.Factory.Initialize();

	_ExcelApplication = new Excel.Application(); <--This causes the Exception 80010108...

	_ExcelApplication.Visible = false;
	_ExcelApplication.DisplayAlerts = false;
	
}

Here is the exception:

System.Runtime.InteropServices.COMException: Creating an instance of the COM component with
CLSID {00024500-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010108.
   at Object System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
   at Object System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
   at static Object System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at void LateBindingApi.Core.COMObject.CreateFromProgId(String progId)
   at void NetOffice.ExcelApi.Application..ctor()
Coordinator
Aug 26, 2011 at 9:38 PM

are you sure excel is installed? :o
it's possible you create a test program with Interop Assemblies and Visual Basic ( CreateObject ) and see the same error occurs?
sounds like a registry problem/security settings maybe. shame on me, i never do any tests on a server with an old office version.
gimme a day, i create these tests for you. please send me your e-mail adress. use codeplex contact user form.

btw: give me informations abour you programm environment. IIS hosted? sandboxed or something like that. 

Coordinator
Aug 28, 2011 at 12:40 PM

hello,
i try to send you a mail but your mail adress is not working.
you have another adress for me?
 

Aug 29, 2011 at 7:43 PM
Edited Aug 29, 2011 at 7:45 PM

I have been able to get it working by providing "Excel.Application.9" to the Application's constructor, instead of relying on COM to find the last used version of Excel.

I guess for some reason the COM runtime isn't finding the right registry entries for my installation of Office 2000. I suppose I could uninstall/reinstall, but it's just as easy for me to make one small change to the instance constructor (My program is only going to run in-house at our home office and won't be distributed commercially).

Once my app gets Excel running, everything is working as I expected.

 

Thanks for your help!