1
我想捕获特定的SoapExceptions,但找不到要使用的错误代码。在c中找不到SoapException错误代码#
我已经尝试使用错误代码;
catch(SoapException e)
{
// Get error code
int ErrorCode = System.Runtime.InteropServices.Marshal.GetExceptionCode(); //System.Runtime.InteropServices.Marshal.GetHRForException(e);
switch (ErrorCode)
{
case -2146233087:
{
// Default parameters have not been established in the report
return "false";
}
default:
{
return "false";
}
}
}
但这不起作用。有谁知道在哪里寻找错误代码? 唯一soloution我可能认为这是做一个字符串匹配上
e.GetBaseException().ToString()
但是这将是丑陋
ANSWER
string ErrorCode = ((e.Detail).FirstChild).InnerText;
http://msdn.microsoft.com/pl-pl/library/system.web.services.protocols.soapexception.code.aspx – Freelancer
您应该输入该答案并将其标记为已接受,以便其他人可以找到它在将来 –