在.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?