【发布时间】:2010-03-23 14:13:18
【问题描述】:
我正在开发一个使用 WCF 服务的 Silverlight 应用程序。在我的浏览器中加载服务元数据时,我注意到它提供了以下代码:
class Test
{
static void Main()
{
myServiceClient client = new myServiceClient();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
}
}
最后一行显示“始终关闭客户端”。我的问题是,您应该何时关闭 Silverlight 应用程序中的客户端?您应该在调用“[MyServiceOperation]Async”之后关闭它,还是应该在“[MyServiceOperation]Completed”事件处理程序中关闭它?
谢谢,
【问题讨论】:
标签: wcf silverlight