0

我们在 ASP.NET 应用程序中使用 ERPConnect,但有时当用户尝试通过我们的应用程序连接到 SAP 时,我们会收到一些错误消息。

CPIC-CALL:'CMRCV:rc=19 LOCATION SAP-Gateway on host SERVERNAME / sapgw10 错误对话 53230591 未找到时间 2011 年 11 月 16 日星期三 13:49:58 发布 701 组件 SAP-Gateway 版本 2 RC 728 模块 gwxxrd.c 行 6278柜台 1277701

通过 ERPConnect 打开与 SAP 的连接时,总是会发生这种情况。

R3Connection connection = Connection;
connection.Open(); // the error occurs here

这是相当随机的。有些日子我们没有收到任何错误消息,有些日子我们每天收到 20 条消息。ERPConnect 使用在 System32 文件夹中定义的 librfc32.dll,版本为 7200.1.39.6461(最新版本)。

这个问题在我的本地开发机器(Windows 7 x86)上没有发生。它总是发生在我们的生产服务器(Windows Server 2008 R2)上。

知道什么可能导致这个问题吗?

编辑(添加错误日志提取):


*                                                                                                                               
*  LOCATION    SAP-Gateway on host HERCULES / sapgw10                                                                           
*  ERROR       partner 'hercules:sapgw01' not reached                                                                           
*                                                                                                                               
*  TIME        Thu Nov 24 09:10:20 2011                                                                                         
*  RELEASE     701                                                                                                              
*  COMPONENT   NI (network interface)                                                                                           
*  VERSION     38                                                                                                               
*  RC          -10                                                                                                              
*  MODULE      nixxi.cpp                                                                                                        
*  LINE        2835                                                                                                             
*  DETAIL      NiPConnect2                                                                                                      
*  SYSTEM CALL connect                                                                                                          
*  ERRNO       10061                                                                                                            
*  ERRNO TEXT  WSAECONNREFUSED: Connection refused                                                                              
*  COUNTER     1385122                                                                                                          
*                                                                                                                               
*****************************************************************************                                                   
GwTraceHdlInfo:                                                                                                                 

HANDLE   = 137                                                                                                                  
TIME     = Thu Nov 24 09:10:19 2011                                                                                             
SOCKET   = 2108                                                                                                                 
STAT     = NI_CONN_WAIT                                                                                                         
TYPE     = STREAM IPv4                                                                                                          
OUT      = 0 messages 0 bytes                                                                                                   
IN       = 0 messages 0 bytes                                                                                                   
LOCAL    = 0.0.0.0:1865                                                                                                         
REMOTE   = -                                                                                                                    
OPTIONS  = BUFFERED                                                                                                             
  ni hdl           = 137                                                                                                        
  type             = CLIENT                                                                                                     
  net_stat         = CONNECT_TO_REM_GW_PENDING                                                                                  
  hostaddr         = 100.100.103.15                                                                                             
  accept_hostaddr  = 100.100.103.15                                                                                             
  opcode           = NORMAL_CLIENT                                                                                              
  conn opcode      = REMOTE_GATEWAY                                                                                             
  conn vers        = 2                                                                                                          
  index            = 10                                                                                                         
  data             = 0000000000000000                                                                                           
  ext_info         = 000000000EF1D870                                                                                           
  offset           = 0                                                                                                          
  rest_len         = 0                                                                                                          
  snc_forced       = 0                                                                                                          
 remote gateway infos:                                                                                                          
  hostname =                                                                                                                    
  hostaddr = 100.100.103.15                                                                                                     
  service  = sapgw01                                                                                                            
  tpname   = sapdp01                                                                                                            

GwSelClear: clear RWC for hdl 137                                                                                               
NiICloseHandle: called for hdl 137 while waiting for connection                                                                 
NiICloseHandle: shutdown and close hdl 137 / sock 2108                                                                          
GwFreeHdlInfoMemory: free 000000000EF1D870 (ext info)                                                                           
GwIFreeMemForLU_TP: freed memory for sys 10                                                                                     
GwListRemove: remove elem 10 from sys_r3_list                                                                                   
GwListRemove: 2 elems in sys_r3_list                                                                                            
GwListRemove: elem 10 not in sys_reg_list                                                                                       
GwListRemove: remove elem 10 from sys_inuse_list                                                                                
GwListRemove: 104 elems in sys_inuse_list                                                                                       
GwUpdateClient: act_sys: 104                                                                                                    
GwIDelR3Conn: send error message to client                                                                                      
GwSendRc3: send (appc_rc=CM_PRODUCT_SPECIFIC_ERROR / sap_rc=GW_CONNECT_FAILED) to client HERCULES / sapgw10 (0)                 
GwRqDpSendTo: (HERCULES / sapgw10, gw_id=0, appc_ca_blk=-1, len=335, comm_index=-1)                                             
LOCK APPC ca_blk 3                                                                                                              
DpGetCpicCommIdx: found index 3 via appc_hdr                                                                                    
found comm entry 3 (tid/uid/mode/conv_id/a_r: 158/13268/0/        /0)                                                           
GwIsAWaitingSWP: wp 1 waiting                                                                                                   
GwSapWpWakeUp: send answer to sap wp 1                                                                                          
GwSapWpWakeUp: make wp 1 owner of appc_ca_blk 3                                                                                 
-OUT- tid         -1            uid  -1           mode  255                                                                     
-OUT- appc_ca_blk 3             len  335          rq_id 43133                                                                   
-OUT- wait_f_answ 0             cmd  0                                                                                          

NiIWrite: hdl 109 sent data (wrt=28,pac=1,MESG_IO)                                                                              
GwIDelR3Conn: decrement conv_no of client 0: 5                                                                                  
GwFreeMemory: free 000000000EEF3480 (len=3700)                                                                                  
GwFreeMemory: act_overflow_size = 20352 (- 3700)                                                                                
GwIDelR3Conn: idx/conv = ((-1/0) | (10/0)), delete conv 48 from conv-table                                                      
GwClearConn: conv_no/tcp_conv_no/sna_conv_no: 6/6/0                                                                             
GwClearConn: free r3 conv info                                                                                                  
GwClearConn: free buffer info                                                                                                   
GwFiSearchConvId: deleted 27077110 local, conn=48                                                                               
GwListInsert: insert elem 48 into conn_free_list (at begin)                                                                     
GwListInsert: 494 elems in conn_free_list                                                                                       
GwListRemove: remove elem 48 from conn_search_list                                                                              
GwListRemove: 0 elems in conn_search_list                                                                                       
GwListRemove: elem 48 not in conn_write_list                                                                                    
GwListRemove: remove elem 48 from conn_inuse_list                                                                               
GwListRemove: 6 elems in conn_inuse_list                                                                                        
GwReadReqIndex: (process_id: -1)                                                                                                
GwReadReqIndex: no filled request-index-block                                                                                   
GwCheckClient: check clients                                                                                                    
LOCK APPC ca_blk 4                                                                                                              
GwCheckClient: raise timeout for conv 27059938 (intr/uid/mode/comm_idx=9/13261/0/90)                                            
GwSendRcToDp: send appc_rc/sap_rc 10001/221 to dp                                                                               
make DISP owner of appc_ca_blk 4                                                                                                
DpSemRq: key: 3, units: 1, timeout: -1                                                                                          
DpSemRel: key: 3, units: 1                                                                                                      
DpRqPutIntoQueue: put request into queue (reqtype 0, prio LOW, rq_id 43134)                                                     
GwDispWakeUp: send wakeup with ni handle 2                                                                                      
NiIWrite: hdl 2 sent data (wrt=1,pac=1,MESG_IO)                                                                                 
-OUT- sender_id APPC_SERVER       tid  165   wp_ca_blk   -1      wp_id -1                                                       
-OUT- action    SEND_TO_WP        uid  13261   appc_ca_blk 4       type  NOWP                                                   
-OUT- new_stat  NO_CHANGE         mode 0     len         80      rq_id 43134                                                    
GwListRemove: remove elem 90 from comm_wait_list                                                                                
GwListRemove: 0 elems in comm_wait_list                                                                                         
GwListRemove: remove elem 90 from comm_wait_list                                                                                
GwListRemove: 0 elems in comm_wait_list 

编辑 2:添加代码示例

我创建了一个小代码示例,如果注意到最后一个连接仍然打开。如果我再次启动示例,则在示例结束时两个连接保持打开状态。所以出了点问题……

protected void SAP( object sender, EventArgs e ) {

    ThreadStart threadStart1 = new ThreadStart( CreateSAP );
    Thread thread = new Thread( threadStart1 );
    Thread thread2 = new Thread( threadStart1 );

    thread.Start();
    Thread.Sleep( 2000 );
    thread2.Start();

    while ( thread2.IsAlive ) {

    }

    Response.Write( "done" );
}

private void CreateSAP() {
    R3Connection conn = ERPConnection.Connection;
    conn.MultithreadingEnvironment = true;

    for ( int i = 0; i < 12; i++ ) {
        try {
            conn.Open();
            Thread.Sleep( 1000 );
        } finally {
            conn.Close();
        }
    }
}
4

2 回答 2

2

不幸的是,这是我在我的代码中所做的,不是很……嗯……很好。ERPConnect 有一个 R3Connection 对象,我在整个应用程序中使用了一个单例。

如果一个用户正在使用一个连接,而另一个用户也请求了一个连接,则 R3Connection 对象会创建一个新连接(您可以使用 SAP 中的 SM04 事务来验证这一点)。但是,如果两个用户都关闭了连接,则两个连接中的一个保持打开状态(我认为这是 ERPConnect 中的一个错误,但我们无法联系他们,因为我们的支持目前已过期)。在生产环境中,连接的限制(在 SAP 中定义)会很快达到。

我现在为每个用户创建一个 R3Connection 对象,因此当在我的代码中调用 Close() 方法(或 using 语句)时,我确定在 SAP 系统中正确关闭了连接。

代码

public static R3Connection Connection {
        get {
            ERPConnect.LIC.SetLic( "MyLicenseKey" );

            R3Connection connection = new R3Connection( 
                        [set connection settings]
                     );
            connection.MultithreadingEnvironment = true;

            return connection;
        }
    }
于 2012-01-26T08:54:58.550 回答
0

我正在寻找一个完全不同的问题的答案,但是当我偶然发现你的问题时,这看起来很像网络配置 - 确保你的 SAP 服务器“hercules”有端口 3210、3310 和 3610(我认为这些是正确的 - 可能是 3201/3301/3601,很难从 SMGW 日志中分辨出来)在 Windows 防火墙中打开,没有任何其他防火墙阻止相关流量,并且“hercules”上的默认网关设置为可以成功将流量路由到 100.100.103.15 的设备(我假设,从您的日志中,这是运行 .NET 应用程序的服务器的 IP 地址),并且 100.100.103.15 上的默认网关设置为一种可以成功地将流量路由到“大力神”的设备。此外,你'

于 2012-01-17T12:20:20.080 回答