Extracting detail from a WCF FaultException response

前端 未结 4 2469
慢半拍i
慢半拍i 2021-02-19 22:29

I am successfully working with a third party soap service. I have added a service reference to a soap web service which has auto generated the classes.

When an error oc

4条回答
  •  失恋的感觉
    2021-02-19 23:28

    You can catch FaultException, which gives you detail for free.

    catch (FaultException ex)
    {
        string yourDetail = ex.Detail;
    }
    

提交回复
热议问题