Using Itaucripto_.dll within web service (without registering on the server)

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 I need to do in a WCF service with asmx? The server raises an exception saying that it can not find the COM class because it is not registered. I do not want to register the DLL on the server; but instead I want to call her without a record. Environment:

  • Visual Studio 2017
  • WCF service application with a web service asmx (I'm trying to instantiate the COM object in the HelloWorld method of asmx)

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
    
asked by anonymous 24.07.2018 / 22:02

1 answer

0

I've already had the same problem, I found the solution reading this OS question: interop type can not be embedded >

The solution was as follows:

1. Registrar o assembly de criptografia do Itaú usando o comando REGSVR32 com privilégios de admin. 
   Exemplo: C:\Windows\System\regsvr32 Itaucripto_.dll
2. Importar o assembly no projeto.
3. Setar a propriedade "Embed Interop Types" com false na dll importada nas referências, 
   pois não é uma DLL que roda sobre o Framework .Net
    
25.07.2018 / 13:37