Web服务的异常抛出问题

corex 2003-08-10 11:36:54
Web方法中抛出的异常不能被Application_Error截获?如何才能让Application_Error截获?

另外,Web方法中抛出的异常客户端能直接截获为SoapException,但是我从Application_Begin中抛出的异常切不能,如何才能?
...全文
21 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-08-10
  • 打赏
  • 举报
回复
Application_Begin???

see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhandlingraisingexceptionsinxmlwebservices.asp

"....
A Web application can be comprised of multiple XML Web services, however the Application_Error event within the Global.asax file cannot be used for global exception handling. The HttpHandler for XML Web services consumes any exception that occurs while an XML Web service is executing and turns it into a SOAP fault prior to the Application_Error event is called. Build a SOAP extension to process XML Web service exceptions in a global exception handler. A SOAP extension can check for the existence of an exception in the ProcessMessage method. Within the ProcessMessage method, check the Exception property of the SoapMessage passed when the Stage property is set to AfterSerialize. For details on SOAP extensions, see Altering the SOAP Message Using SOAP Extensions.
...."
corex 2003-08-10
  • 打赏
  • 举报
回复
不好意思,应该是Application_BeginRequest。
请问有没有办法从这个方法中抛出异常而让客户端接收到呢,就如同在WebMethod中抛出。

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧