【问题标题】:Catch external service fault exception into wcf riaservice将外部服务故障异常捕获到 wcf riaservice
【发布时间】:2013-07-12 05:56:24
【问题描述】:

我有 wcf 服务,我将它用于 ASP.net MVC 和 WCF RIA 服务。我能够将错误异常捕获到 ASP.net MVC 中,但无法捕获到 WCF RIA 服务。

以下代码适用于我使用 WCF 服务的 wcf ria 服务

public class MyService : LinqToEntitiesDomainService<MyEntities>
{
    try
    {    
        ExternalServiceProxy.SaveData();
    }
    catch(FaultException<ExceptionInfo> ex)
    {
        //Not able to catch faultexception
    }
    catch(Exception ex)
    {
        //Every time catch exception and faultexception information lost
    }
}

【问题讨论】:

    标签: wcf silverlight wcf-ria-services


    【解决方案1】:

    你确定你有正确的异常类型吗?在您的“catch(Exception ex)”语句中,检查异常的具体类型。它可能是 Exception 的子类,但不是 FaultException。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-21
      • 2020-11-02
      • 2011-04-07
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      • 2013-01-13
      • 2016-03-19
      相关资源
      最近更新 更多