如何使WCF客户端使用相同的数据类型为WCF服务 [英] How to make WCF client use the same data types as the WCF service

查看:145
本文介绍了如何使WCF客户端使用相同的数据类型为WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net WCF服务,服务只有.NET WCF客户端(所有的.NET 3.5,没有互联互通,通过TCP,二进制编码)。 使用svcutil.exe的所使用的服务的数据成员的复合类型中产生所使用的客户端的proxy.cs类的一部分。

I have a .NET WCF service that services only .NET WCF clients (all .NET 3.5, no interoperability, via TCP, binary encoding). Using svcutil.exe the composite types that are used by the data members of the service are generated as part of the proxy.cs class used by the clients.

然而,怎么做,如果我想引用在服务器/ WCF方声明的同类型? 场景: 3组件:client.exe,wcfobjects.dll和wcfservice.dll - >在wcfservice.dll参考wcfobjects.dll - >客户端也引用wcfobjects.dll

However, what to do if I wanted to reference the same types declared on the server/WCF side? Scenario: three assemblies: client.exe, wcfobjects.dll and wcfservice.dll --> the wcfservice.dll references wcfobjects.dll --> the client too references wcfobjects.dll

我怎样才能生成一个代理,不包括使用的服务类型? 那可能吗? 谢谢你。

How can I generate a proxy that does NOT include the types used by the service? Is that possible? Thanks.

找到这样的回答: 为了svcutil.exe的不生成的客户端代理类型,你需要明确地引用wcfobjects.dll的提示:

Found this answer: in order for svcutil.exe to NOT generate the types in the client proxy, you need to explicitly reference the wcfobjects.dll at the prompt:

SvcUtil工具*的.wsdl *的.xsd /异步/ TCV:Version35 /语言:C#/r:\wcfobjects.dll /out:\Proxy.cs /config:\App.config

再次感谢。

推荐答案

在添加服务引用对话框中,在高级选项卡,指定重复使用现有的类型。

In the "Add Service Reference" dialog, on the "Advanced" tab, specify "Reuse existing types".

这篇关于如何使WCF客户端使用相同的数据类型为WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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