zoukankan      html  css  js  c++  java
  • 当调用wcf, 小心返回值包含enum越界的错误。

    前段时间处理过一个调用wcf的exception(那是一个非常奇怪的exception, 经过line by line的调试,exception是在调用出wcf operation的时候抛的):

    System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:59.9730000'. ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:59.9730000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

     

    今天又遇到这个exception,而且都是在刚出wcf operation 调用的时候抛得,但郁闷的是我们竟然忘了上次是什么原因造成,怎么解决的了。

    今天只能由重新调查,第一感觉可能是server和client的接口定义不一致的,但通过调查,包括使用wcftestclient测试,发现感觉是错误的。

    但错误是怎么导致的?通过comment一些代码测试后,大家终于搞清楚了原因,最让我们感到脸红的是这个错误跟前段时间处理的exception完全是同一个问题导致的,竟然我们都忘记了原因。

    所以再此记录下来:

    这个原因:在返回client的结构中有一个enum的属性越界了,那是因为server代码没有检查enum是否越界,直接强制转换成enum. 当从server返回client一个越界的enum就产生了那个exception.

    汗。

  • 相关阅读:
    安卓触摸事件探究
    android关于canvas,path,paint非常好的讲解
    android的Shader
    android中view的生命周期
    JAVA的Random类(转)
    lniux 64位导致adb无法运行解决方案
    [转]Android中attrs.xml文件的使用详解
    FlowLayout
    大数据平台架构技术选型与场景运用(转)
    mysql--java类型对应表
  • 原文地址:https://www.cnblogs.com/lxg226/p/1837048.html
Copyright © 2011-2022 走看看