回调操作(Call Back)请求超时

错误信息:

发送到 net.tcp://10.10.77.28:8003/MyHello 的请求操作在配置的超时(00:01:00)内未收到回复。分配给该

操作的时间可能是更长超时的一部分。这可能由于服务仍在处理操作或服务无法发送回复消息。请考虑增加操

作超时(将通道/代理转换为 IContextChannel 并设置 OperationTimeout 属性)并确保服务能够连接到客户端。

 

解决:

在客户端应用程序中配置回调服务实现:[CallbackBehavior(UseSynchronizationContext = false)]



二、

问题:超时问题,在最后获取数据的时候突然提示服务超时,服务已断开

解决:配置文件添加:

<bindings>
      <wsHttpBinding>
        <binding name="BindConfig" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>


问题三:解决上述问题之后又出现了新问题,在服务端可以获取得到数据,但是到了客户端总是空,然后准备测试数据,在服务端只给一个int型的变量,客户端获取的到,但是一旦换成自己的自定义类,客户端就获取不到

解决:在服务端和客户端都要有自定义类,代码要一样,另外还要保证两个类的命名空间一致

如:服务端

[DataContract(Namespace = "Rostering.BO")]
    [Serializable]
    public class NewAttendancePlan
    {
        [DataMember]
        public int AttendancePlan_Id { get; set; }
    }

客户端一样:

[DataContract(Namespace = "Rostering.BO")]
    [Serializable]
    public class NewAttendancePlan
    {
        [DataMember]
        public int AttendancePlan_Id { get; set; }
 
后来验收的时候又出现了个问题:客户端还是无法获取服务端的数据,真的不知道是哪儿的问题,程序也没动过,,,,,找问题呀找问题,,,最后是因为客户端的时间和服务端的时间不一致,在网上也看到类似的说法,如果客户端和服务端的时间差超过5分钟,通信将失败,,,,???????