Webservice自定义SoapException抛出导致HTTP500错误 [英] Webservice custom SoapException Throwing causes HTTP500 error

查看:430
本文介绍了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, <温泉n style ="font-size:x-small; color:#2b91af"> 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 ?

推荐答案

是什么让你感到惊讶认为你做错了什么?您期望发生什么?

如果您在浏览器中查看它,您很可能只会看到"浏览器"。像500错误的事情。如果您想将其视为例外,请创建一个简单的客户端程序来调用您的服务。
What makes you think you did anything wrong? What were you expecting to have happen?

If you're looking at it in a browser, chances are you'll only see "browser" things like a 500 error. If you want to see it as an exception, then create a simple client program to call  your service.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆