Failure of Class Factory Recovery - Console Application

4

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

  

System.Runtime.InteropServices.COMException (0x80040154):   COM component factory recovery with CLSID   {443DDDD3-7E78-44C6-865C-7984C9D2B08A} due to the following error:   80040154 Class not registered (Exception from HRESULT: 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 for X86 , which is the version of S.O and .Net 4.5.2 that is installed on the server, as shown below:

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

  

The "System.Data.dll" module was loaded, but the entry point was not   found. \ n \ nMake sure 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();

    
asked by anonymous 14.12.2016 / 17:38

1 answer

0

Windows Server is usually x64. Ideally you would compile your application for AnyCPU. I believe that this way will not generate exception.

    
05.01.2017 / 04:01