ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

44、深入探索Windows Communication Foundation开发实践

44、深入探索Windows Communication Foundation开发实践

深入探索Windows Communication Foundation开发实践

在Windows Communication Foundation(WCF)的开发中,有许多实用的技巧和方法可以帮助我们构建高效、灵活的服务。下面将详细介绍几个重要的练习内容。

练习2:附加和访问主机扩展

本练习主要包括两个主要任务:创建主机扩展以及将扩展附加到主机并使用它。

创建主机扩展
  1. 检查任务列表的内容。
  2. 双击注释TODO: Ex2 – Implement the CacheHostExtension Attach method,打开CacheHostExtension.vb文件。
  3. Attach方法中添加以下代码:
HostCache = HttpRuntime.Cache AddHandler owner.Closed, AddressOf owner_Closed AddHandler owner.Faulted, AddressOf owner_Faulted
  1. 双击注释TODO: Ex2 – Implement the CacheHostExtension Detach method定位到Detach方法。
  2. Detach
返回列表