WCF技术内幕 第4章 (2)
暴露元数据
在大部分现实世界的应用系统里,有这样一个需求,即发送者询问接收者的终结点并提取元数据,然后使用这些元数据构建能发送给接收终结点消息的基础结构。
如果决定暴露系统的元数据,可以构建一个暴露元数据的终结点,而构建元数据终结点的方式和其他终结点非常相似:使用地址,绑定和契约(ABC)。
using System;namespace ClientApp{ class Program { static void Main(string[] args) { Console.WriteLine("Press ENTER when the receiver is ready"); Console.ReadKey(); Console.WriteLine("Sending a message to the receiver"); HelloWCFContractClient proxy = new HelloWCFContractClient(); proxy.Say("NI DA YE DE, WCF!!!"); proxy.Close(); Console.WriteLine("Finished sending a message to the receiver"); Console.ReadKey(); } }}