COMException (0x80040154) in „Any CPU“ .NET application
You get a COMException(0x80040154) when running a .NET application compiled for „Any CPU“ on 64-bit Windows.
Rfc Connector is a 32-bit COM library and cannot be called from 64-bit processes.
Change your project build target from „Any CPU“ to „x86“:
From the toolbar in Visual Studio, select „Configuration Manager“:
We cannot provide a 64-bit version of Rfc Connector, because SAP has not released a 64 Bit SAP GUI yet. As soon as a native 64-bit SAP GUI is available, we will release 64 bit version of Rfc Connector. According to SAP Note 1442028, a 64 bit version of SAP GUI is planned, but there is no fixed release date yet.