Connect to SAP gateway failed

November 14, 2009

I received an error (in the windows event log) the other day when trying to configure a BizTalk receive location using the WCF LOB SAP adapter. The error looked like this:


The Messaging Engine failed to add a receive location "" with URL "" to the adapter "WCF-Custom".
Reason: "Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_OK. ErrorGroup=RFC_ERROR_COMMUNICATION. SapErrorMessage=Connect to SAP gateway failed
Connect_PM TPNAME=, GWHOST=, GWSERV=

One solution (as suggested by MSDN) is to install the SAP client.

This solution works, but what is it about the SAP client install that is required by the WCF LOB SAP adapter? Why should you have to install the SAP client on a production server?

It turns out the SAP client modifies the following file: c:\windows\system32\drivers\etc\services, by making entries to resolving the SAP gateway host’s name (as used in BizTalk WCF SAP receive location’s URI) to the gateways address.

Once you manually modify this file to contain these entries the WCF SAP BizTalk receive location will work without having to install the SAP client.