通过C#Web API访问SAP RFC时遇到错误。以下是详细信息: 我能够从SAP RFC获得存储在out param中的响应,但是在将其返回给我的函数时抛出异常。这是代码:
internal string FromBupaToBupaGuid(string sBupa)
{
using (SAPContext db = new SAPContext(base.GetConnectStringForRfcUser()))
{
ERPConnect.LIC.SetLic(base.GetLicenseKey());
string sBupaGuid;
SAPContext.MESSAGESTable mESSAGESTable = new SAPContext.MESSAGESTable();
sBupa = ToBupa(sBupa);
db.IST_GET_BPARTNER_GUID(out sBupaGuid, sBupa, mESSAGESTable);
return sBupaGuid;
}
}
以下是异常信息:
System.AccessViolationException was unhandled
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=ERPConnect40
StackTrace:
at ERPConnect.RFCAPI.RfcCallReceiveExt(Int32 handle, Int32 hSpace, String FuncName, StringBuilder Exception)
at ERPConnect.R3Connection.Ping()
at ERPConnect.Linq.ERPDataContext.Dispose(Boolean disposing)
at ERPConnect.Linq.ERPDataContext.Dispose()
注意:代码中没有问题,因为它安静的旧代码在我早期的机器(Windows 7 + VS 2012)中工作正常,现在正在使用Windows 8.1。
我已经尝试过了:
请帮忙。
答案 0 :(得分:0)
I am getting the same issue when trying to use standard BAPI function using the connection.CreateFunction() method. It seems to be occurring randomly as well.
RFCFunction funcModify = _r3Connection.CreateFunction("BAPI_ALM_NOTIF_DATA_MODIFY");
funcModify.Exports["NUMBER"].ParamValue = notifNo.PadLeft(12,'0');
I have posted a ticket with theobald software, owners of ERPconnect. Will post any useful info if i manage to get to to work.
答案 1 :(得分:0)
对于我的情况,问题与 SystemWow 文件夹中缺少 librfc32.dll 有关,我通过放置两个librfc dll解决了问题:一个用于32位和另一个是 Windows / Systems 文件夹中的64位。
我已经引用了以下链接,它包含有关库位置和dll的必需信息:
希望这有助于他人。