本文介绍了Webservice自定义SoapException抛出导致HTTP500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个包含webmethod的web服务,如果参数验证失败,它应该抛出异常。
但是,当抛出异常时(我用调试器检查过)客户端浏览器上显示的所有内容都是HTTP 500错误。
未显示异常的自定义消息。

代码段:


试试

Hi,

I have a webservice that contains a webmethod which should throw an exception if parameter validation fails.
However, when the exception is thrown (which I checked with the debugger) all that shows on the client browser is an HTTP 500 error.
The custom message of the exception doesn't appear.

Code snippet :

try

{

返回 存款 .retrieve(SPARM);

}

return Deposit.retrieve(sParm);

}

catch 例外 e)

{

catch (Exception e)

{

SoapException soapEx = new SoapException (e.Message, SoapException .ClientFaultCode);

SoapException soapEx = new SoapException(e.Message, SoapException.ClientFaultCode);

 

throw soapEx;

}

在VS2005 / VS开发服务器上运行,XP Pro

谢谢,

MetaMeta
什么我做错了吗?

throw soapEx;

}

Running on VS2005/VS Development Server, XP Pro

Thanks,

MetaMeta 
What did I do wrong ?

推荐答案


这篇关于Webservice自定义SoapException抛出导致HTTP500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 23:13