首页 > 数据库技术 > 详细

WCF Failed to invoke the service. Possible causes: The service is offline or inaccessible

时间:2015-05-19 18:36:48      阅读:452      评论:0      收藏:0      [点我收藏+]

今天写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.

 

WCF Failed to invoke the service. Possible causes: The service is offline or inaccessible

原文:http://www.cnblogs.com/hbb0b0/p/4514904.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!