COMException (0x80040154) in „Any CPU“ .NET application

Symptom

You get a COMException(0x80040154) when running a .NET application compiled for „Any CPU“ on 64-bit Windows.

Reason

Rfc Connector is a 32-bit COM library and cannot be called from 64-bit processes.

Solution

Change your project build target from „Any CPU“ to „x86“:

  1. From the toolbar in Visual Studio, select „Configuration Manager“:

    Configuration Manager

  2. In the Configuration Manager, change the „Debug“ and „Release“ configuration‘s platform from „Any CPU“ to „x86“:

    Configuration Manager

Additional Information

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.