小编Hen*_*den的帖子

如何使用 sapnwrfc 库连接到 SAP?

我们的软件是用 C# 编写的,需要连接到 SAP。由于我们的一些客户使用旧版本的 SAP,而其他客户没有 SAP PI,因此我们无法通过 Web 服务进行连接。

我尝试通过 SAP NetWeaver 远程函数调用库 (sapnwrfc.dll) 连接到 SAP,如下所示:

  • 将 sapnwrfc.dll 和 NWRFC_6-20004550.SAR 中的其他 dll(即 icudt34.dll、icuin34.dll、icuuc34.dll、libicudecnumber.dll 和 libsapucum.dll)添加到 C:\WINDOWS\system32,以确保它们可以被找寻到。
  • 在我的 C# 代码中,在类定义中添加以下内容:
        [DllImport("sapnwrfc.dll", CharSet = CharSet.Auto)]
        public static extern void RfcInit();
    以及应该完成工作的方法中的以下内容:
        RfcInit();

运行此代码会出现 DllNotFoundException:
Unable to load DLL 'sapnwrfc.dll': This application has failed to start because the application configuration is不正确。重新安装应用程序可能会解决此问题。(来自 HRESULT 的异常:0x800736B1)

运行标准的 connect-to-C++-from-C# 示例
    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);
    MessageBox(new …

c# sap dllnotfoundexception saprfc

5
推荐指数
1
解决办法
8743
查看次数

标签 统计

c# ×1

dllnotfoundexception ×1

sap ×1

saprfc ×1