我一直在使用 using
语句将调用 WCF 的所有代码包装起来,以确保对象能够正确地释放。当我搜索“Http service located at .. is too busy”异常时,我找到了这个链接:http://msdn.microsoft.com/en-us/library/aa355056.aspx,上面说在类型化代理中不应使用 using
语句。这是真的吗?我认为我需要进行大规模的代码更改(叹气)。这个问题只会出现在类型化代理中吗?
示例代码:
private ServiceClient proxy;
using(proxy = new ServiceClient("ConfigName", "http://serviceaddress//service.svc")){
string result = proxy.Method();
}