0
I tried to put the COM DLL in the webservice project (using the code below to include it):
<Project ...>
<ItemGroup>
<COMFileReference Include="itaucripto_.dll">
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMFileReference>
</ItemGroup>
</Project>
Is there anything else you need to do on a WCF service with asmx? The server makes an exception saying that it cannot find the COM class because it is not registered. I don’t want to register the DLL on the server; but instead I want to call it without registration. Ambience:
- Visual Studio 2017
- WCF service application with an asmx web service (I’m trying to instantiate the COM object in asmx’s Helloworld method)
Code:
Itaucripto.cripto itau = new Itaucripto.cripto();
Exception:
An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code
Additional information: Retrieving the COM class factory for component
with CLSID {E9067548-B9D1-4146-BEDC-0F7BFEDF6E94} failed due to the
following error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG)). occurred
Isn’t it a question of x64 vs x86? Ex.: You are compiling your project into 64 and dll is 32
– Leandro Angelo
I forced the project to 32bits (x86), nothing.
– Fabricio Araujo
The problem happens in debug by visual studio or only when you publish in IIS?
– Leandro Angelo
Debugging by IIS Express in VS.
– Fabricio Araujo
Even with Plataform target x86 and allow unsafe code marked?
– Leandro Angelo
I just marked Unsafe Code. Nothing.
– Fabricio Araujo