Class Factory Recovery Failure - Console Application

Asked

Viewed 1,934 times

4

I have a Console Application that performs connection with the SQL. On other machines the application is working normally, but has one that has the version Windows Server Enterprise SP2 who is returning the following exception:

System.Runtime.Interopservices.Comexception (0x80040154): Failure in the Factory recovery of component COM classes with CLSID {443DDD3-7E78-44C6-865C-7984C9D2B08A} due to the following error: 80040154 Unregistered class (HRESULT exception: 0x80040154 (REGDB_E_CLASSNOTREG)). in System.RuntimeTypeHandle.Createinstance(Runtimetype type, Boolean publicOnly, Boolean noCheck, Boolean & canBeCached, Runtimemethodhandleinternal& ctor, Boolean& bNeedSecurityCheck)

The application is being compiled to X86, which is the version of S.O and .Net 4.5.2 that is installed on the server, as illustrated in the image below:

When trying to register the class System.Data.dll with the regsvr32you have the following output:

The "System.Data.dll" module was loaded, but the entry point was not found. n nCertifies that "System.Data.dll" is a valid DLL or file OCX and try again

Connection code

var cnx = ""DATA SOURCE=IPSERVER;INITIAL CATALOG=DBNAME; INTEGRATED SECURITY=FALSE;USER ID=USERID;PASSWORD=PASSWDUSER;MULTIPLEACTIVERESULTSETS=TRUE; POOLING=FALSE";";

var conn = new SqlConnection(cnx);

conn.Open();

inserir a descrição da imagem aqui

  • System.Data.dll is an Assembly of the Framework, you should not register using regsvr32. With the Framework installed it will be accessible. Have you searched the registry for the CLSID entry of the error message? As you said your OS is 32bits (x86), the chvae should probably be in HKEY_CLASSES_ROOT CLSID{443DDDD3-7E78-44C6-865C-7984C9D2B08A}

  • Better repair the installation of . net: https://docs.microsoft.com/pt-br/dotnet/framework/install/repair and remember to turn off all non-essential Windows services

1 answer

0

Windows Server is usually x64. The ideal would be for you to compile your application for Anycpu. I believe this way will not generate Exception.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.