System.Runtime.InteropServices.COMException error in C# implementation of FAXCOMEX LIb

1

Here's the problem.

I wrote a Windows service in C# (Visual Studio 2012) which queries a MS SQL database and then uses FAXCOMEXLIB to send a fax.

I am able to reference FAXCOMEXLIB and use the server class and fax document class. Faxes are created and sent.

However when I try to use any other class in the FAXCOMEXLIB library I get the following error when I run the service (It compiles without any errors):

System.Runtime.InteropServices.COMException (0x80040111): Retrieving the COM class 
factory for component with CLSID {43C28403-E04F-474D-990C-B94669148F59} failed due to 
the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

This is triggered by

FAXCOMEXLib.FaxOutgoingArchive faxOutgoing = new FAXCOMEXLib.FaxOutgoingArchive();

I tried to run

 regsvr32.exe fxscomex.dll

It didn't help.

I have also tried to manually create and import following registry keys.

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}]
@="FaxOutgoingArchive Class"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}\InprocServer32]
@=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,66,00,78,00,\
73,00,63,00,6f,00,6d,00,65,00,78,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}\ProgID]
@="FaxComEx.FaxOutgoingArchive.1"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990CB94669148F59}\Programmable]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}\TypeLib]
@="{2BF34C1A-8CAC-419F-8547-32FDF6505DB8}"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}\Version]
@="1.0"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{43C28403-E04F-474D-990C-B94669148F59}\VersionIndependentProgID]
@="FaxComEx.FaxOutgoingArchive"

The registry keys did not help. I have tried to run the service on Windows 7 64Bit, Windows Server 2012 64Bit and Windows Server 2008 32 bit with same exact result.

Any advice would be much appreciated.

c#
.net
windows
fax
asked on Stack Overflow Dec 7, 2012 by user1886041

1 Answer

1

It's a bug in your code, you are not supposed to create an instance of FaxOutgoingArchive yourself. It is explicit in the MSDN documentation:

To create a FaxOutgoingArchive object in Microsoft Visual Basic, retrieve the OutgoingArchive property of the FaxFolders object.

In case that's confusing, the same rule applies to C#

answered on Stack Overflow Dec 7, 2012 by Hans Passant • edited Dec 7, 2012 by Hans Passant

User contributions licensed under CC BY-SA 3.0