.NET Core WCF捕获肥皂异常

时间:2018-05-30 19:47:16

标签: c# wcf soap .net-core

在.NET Framework中,我可以像下面一样捕获SoapException。这将允许我阅读Exception XML。

        try
        {
            // soap call here
        }
        catch (System.Web.Services.Protocols.SoapException soapEx)
        {
            var msg = soapEx.Message;
            var txt = soapEx.Detail.InnerText;
        }

在.NET Core中,我使用svcutil将WSDL生成为代码,并以编程方式构建端点和绑定以调用客户端。

        var endpointAddress = new EndpointAddress(endpointUrl);
        var binding = new BasicHttpsBinding();

        // call client passing endpoint and binding

由于我无法再访问.NET Core中的SoapException,如何检索异常XML?

0 个答案:

没有答案