INVALID_SESSION_ID错误Salesforce Enterprise API

时间:2014-05-01 08:22:54

标签: c# asp.net api session salesforce

目前,我正在使用ASP.net和Salesforce Enterprise API开发本地服务和Salesforce之间的集成。

但是我遇到了一个问题:

"INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: xxxxxx
This is expected, it can happen if the session has expired and swept away, or if the user logs out, or if its just someone trying to
     入侵。“

当我尝试调用create函数时出现此错误 当我调用查询函数时,一切运行顺利。

会话时间设置为8小时 在“会话设置”中,取消选中“锁定其发起的IP地址的会话”。

知道问题的来源吗?

1 个答案:

答案 0 :(得分:0)

错误消息在这里有点误导。在这种情况下,会话ID在超时后不会过期,我想它是需要设置的端点URL。 (不确定)。我没有尝试理解造成问题的原因,而是通过捕获FaultException(下面的代码)并再次调用登录来解决它。它就像一个魅力。

catch (FaultException ex)
{
  if (ex.Code.Name == "INVALID_SESSION_ID")
   {                    
       Login();  
       //call your method again.                  
   };
}