zoukankan      html  css  js  c++  java
  • WCF Failed to invoke the service. Possible causes: The service is offline or inaccessible

    今天写WCf 时遇到如下报错:

    调试过程发现,各个过程都无异常,但是返回给调用端数据时出现如下错误。

    Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

    最后检查,导致此错误的原因是
    [DataContract]
        public class Student
        {
            [DataMember]
            public int PersonId { get; }
            [DataMember]
            public string Name { get; set; }
            
        }
        
        改成如下就好了:
        [DataContract]
        public class Student
        {
            [DataMember]
            public int PersonId { get;private set; }
            [DataMember]
            public string Name { get; set; }
            
        }
        
       wcf 服务序列化只读属性会出现问题,导致Failed to invoke the service.

  • 相关阅读:
    电路学习实战分析之mos-2
    我这博客咋分类的?
    学习shell之后,实战分析
    二叉树,二叉排序树,红黑树 学习
    哈希表 学习
    《转》C语言可变参函数的实现
    Linux工具记录
    苏州之旅有感
    git 命令动画学
    软件工程相关博客
  • 原文地址:https://www.cnblogs.com/hbb0b0/p/4514904.html
Copyright © 2011-2022 走看看