最大限度地减少 WCF 客户端占用空间
有人可以对此进行一些说明吗?
如何消除更新 Web 引用的需要并最大限度地减少 web.config
中的 WCF 客户端占用空间,以提高代码可维护性。
提前谢谢
BB
Can somebody through some light on this?
How can I eliminate the need of updating web references and minimize the WCF client footprint in web.config
in order to improved code maintainability.
Thanks in advance
BB
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不完全确定最小化 WCF 客户端占用空间是什么意思 - 但 VS 工具和
svcutil.exe
通常会做太多的事情 - 因此手动执行操作,知道 你所做的,绝对可以最大限度地减少你需要的代码和配置的数量。为此,WCF 有大量视频资源专门处理该主题:
Not entirely sure what you mean by minimize WCF client footprint - but the VS tools and
svcutil.exe
typically do way too much stuff - so doing things manually, knowing what you do, can definitely minimize the amount of code and config you need.For that, there's are a bunch of video resources for WCF that deal with that exact topic:
最好的选择是完全取消服务引用。但是,只有当您有权访问包含实际服务接口、操作协定和数据协定的程序集时,才能执行此操作。然后,您可以使用 ChannelFactory 动态创建服务代理:
在您的配置文件中,您所需要的只是端点定义:
这就是您能得到的尽可能少的定义。
The best bet is to do away with service references altogether. However you can only do this if you have access to the assemblies which contain the actual service interface, operation contracts, and data contracts. Then you can create a service proxy on the fly using ChannelFactory:
In your config file all you need is the endpoint definition:
Thats about as minimal as you can get.