【问题标题】:Disposal of WCF clients where soap faults are routinely used处理经常使用肥皂故障的 WCF 客户端
【发布时间】:2010-12-17 00:53:57
【问题描述】:

我最近一直在研究 WCF 客户端处置的棘手问题。 我见过的一种常见解决方案是:

try
{
    client.Call();
    client.Close();
    success = true;
}
finally
{
    if(!success) client.Abort();
}

但是,即使服务已正确运行,此方法也会在服务返回 soap:fault 时中止。

如果定期返回故障,大量中止是否会导致我的系统运行出现问题?

【问题讨论】:

    标签: c# .net wcf web-services


    【解决方案1】:

    中止不会给您带来任何问题。导致问题的原因是连接处于故障状态。

    另请参阅:Reuse a client class in WCF after it is faultedservice.close() vs. service.abort() - WCF example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-11
      • 2019-01-27
      • 2023-03-22
      • 2013-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      相关资源
      最近更新 更多