IIS and IISExpress with COM libraries

0

My Web Application working with COM library, I use this code:

Type headType = Type.GetTypeFromProgID("Eapi.Head");
dynamic head = null;
head = Activator.CreateInstance(headType);

And I have some problem with understanding working IIS. When I debug my webapp in VisualStudio, running IISExpress and all work. But after publication project on IIS, application is not find COM library.

HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

IIS on same computer as I'm develop project.

Im registry this dll 2 ways:

C:\WINDOWS\system32>regsvr32.exe c:\EOS\Delo\API\Eapi.dll
C:\WINDOWS\system32>cd ..
C:\Windows>cd SysWOW64
C:\Windows\SysWOW64>regsvr32.exe c:\EOS\Delo\API\Eapi.dll
C:\Windows\SysWOW64>
c#
iis
com
asked on Stack Overflow May 28, 2020 by GRiN_STONE

1 Answer

0

When it comes to 0x80040154 REGDB_E_CLASSNOTREG and you are sure you registered COM server, the likely problem is 32/64 bitness mismatch.

Regardless of which regsvr32 you use, it would register in-process COM server with the bitness of the DLL.

IIS application pool has its own bitness setting and when the two mismatch your in-process COM server becomes unavailable.

Typical solutions are either build DLL for the other bitness and register respectively, or change IIS application pool bitness to reach the matching, see instructions here:

answered on Stack Overflow May 28, 2020 by Roman R.

User contributions licensed under CC BY-SA 3.0