NET 6 Blazor WASM 处理 SAP 集成问题

NET 6 Blazor WASM Working With SAP Integration Problem

我正在尝试将我的 blazor wasm 应用程序集成到 sap。但是当我调用下面的代码时,IIS 池正在停止。但是当我 运行 在我的 visual studio 上进行项目时,它运行成功。我认为 IIS 无法将 SAP dll 注入 wasm。我该如何解决这个问题?

调用此代码时捕获错误:sapConnection.Connect();

我的代码:

 public async Task<Result<SAPOrderResponse>> GetOrderByOrderNum(string orderNum, string kalemInfo = null)
    {
        SAPOrderResponseModel response = new SAPOrderResponseModel();
        Log.Information("GetOrderByOrderNum");
        try
        {
            Log.Information("GetOrderByOrderNum 1");
            using (var scopeFactory = serviceProvider.CreateScope())
            {
                Log.Information("GetOrderByOrderNum 2");
                using (sapConnection = new SapConnection(GetConnectionString()))
                {
                    Log.Information("GetOrderByOrderNum 3");
                    sapConnection.Connect();
                    Log.Information("GetOrderByOrderNum 3.5");
                    using (var sapFunction = sapConnection.CreateFunction("ZDYS_SIPARIS_ISYERI"))
                    {
                        Log.Information("GetOrderByOrderNum 4");
                        SAPOrderRequest orderRequest = new SAPOrderRequest
                        {
                            KalemInfo = kalemInfo,
                            OrderNum = orderNum,
                        };
                        Log.Information("GetOrderByOrderNum 5");

                        response = sapFunction.Invoke<SAPOrderResponseModel>(orderRequest);
                        Log.Information("GetOrderByOrderNum 6");
                        return await Result<SAPOrderResponse>.SuccessAsync(response.OrderResponse);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Log.Error(ex.Message);
            Log.Error(ex.Message + "\n" + ex.StackTrace);
            return await Result<SAPOrderResponse>.FailAsync(ex.Message);
        }

我添加了名为 “sapnwrfc.dll、icuuc50.dll、icuin50.dll、icudt50.dll”到 system32 和 sysWow64 文件夹解决了我的问题,

你可以访问这个 link 并解决这个问题。

https://github.com/huysentruitw/SapNwRfc/issues/37