捕获SOAP异常.NET
我想知道如何正确捕获soap异常。我只能将其捕获为system.net.webexception(错误500 HTTP),但不能捕获为soapheaderexception或soap异常 我目前的代码是:捕获SOAP异常.NET,.net,exception,soap,.net,Exception,Soap,我想知道如何正确捕获soap异常。我只能将其捕获为system.net.webexception(错误500 HTTP),但不能捕获为soapheaderexception或soap异常 我目前的代码是: Try 'Code Catch soapExcpHeader As System.Web.Services.Protocols.SoapHeaderException 'Can't catch here Dim error_des
Try
'Code
Catch soapExcpHeader As System.Web.Services.Protocols.SoapHeaderException
'Can't catch here
Dim error_desc As String = soapExcpHeader.Detail.OuterXml
Throw New System.Web.Services.Protocols.SoapHeaderException()
Catch soapExcp As System.Web.Services.Protocols.SoapException
'Can't catch here
Dim error_desc As String = soapExcp.Detail.OuterXml
Throw New System.Web.Services.Protocols.SoapException
Catch webExcp As System.Net.WebException
'Here I catch
Console.WriteLine(webExcp.ToString())
Throw webExcp
Catch ex as Exception
'Other types of exceptions
Throw ex
End Try
一如既往地感谢您的回复。尝试查看异常的GetType()属性的值,如果您的catch块没有在System.Web.Services.Protocols.SoapHeaderException上停止,则表示您的异常没有继承它