zoukankan      html  css  js  c++  java
  • 枚举类型引起WCF的错误——“This could be due to the service endpoint binding not using the HTTP protocol”

    在博客园招聘频道的开发中,调用一个WCF服务时,遇到这样的错误:

    An error occurred while receiving the HTTP response to http://wwww.cnblogs.com/test.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

    后来发现是因为数据库中一条记录的一个字段值是0,在程序中读取时转换为相应的枚举类型(enum),而该枚举类型没有定义0所对应的枚举值。这种情况下,转换为枚举类型不会引发异常,转换后该属性的值仍为0。但是返回给WCF客户端时,就会引发上面的异常。

    解决方法很简单,只要在枚举类型中定义一下0所对应的枚举值。

  • 相关阅读:
    golang包管理工具glide安装
    kafka单机安装和启动
    python爬虫得到unicode编码处理方式
    束带结发洛杉矶到付款啦就是的开发
    是的发送到
    【业务】
    下载
    Peach+Fuzzer
    【Selenium】IE浏览器启动问题
    TestNG
  • 原文地址:https://www.cnblogs.com/dudu/p/1932219.html
Copyright © 2011-2022 走看看