DataContract不在ServiceReference中 [英] DataContract not in ServiceReference

查看:64
本文介绍了DataContract不在ServiceReference中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[DataContract(Name = "PublishToDataContract")]
public class PublishToDataContract
{
    [DataMember]
    public readonly string PublishToAddress;
    [DataMember]
    public readonly string FaultAddress;
    [DataMember]
    public readonly string MethodId;
}



这是我的数据合同代码.它与我的服务合同位于同一命名空间中.

当我将ServiceReference添加到客户端时,Service合同是可见的,但datacontract却不可见.

有什么想法吗?



This is my code for a Datacontract. It is in the same namespace as my service contract.

When I add the ServiceReference to the client, the Service contract is visible, but not the datacontract.

Any ideas?

推荐答案

您的服务中是否有公开"PublishToDataContract"类的方法?如果不是,那么这就是为什么客户端中的代理类不包含定义的原因.
试试看-在WCF服务的界面中(然后实现它)
Do you have a method in your service that exposes your ''PublishToDataContract'' class? If not then this is why the proxy class in your client doesn''t contain the definition.

Try this - In the interface of your WCF service (And then implement it)
[OperationContract]
void ExposeContract(PublishToDataContract item);


这会将发布数据契约公开给客户端.

请记住,这有点忽悠. :)


This will expose the publish to data contract to the client.

Bear in mind that this is a bit of a fudge Smile | :)


这篇关于DataContract不在ServiceReference中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆