RIA Services服务器端异常处理

编程入门 行业动态 更新时间:2024-10-25 12:25:42
本文介绍了RIA Services服务器端异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图找出一种方法来处理未处理的在服务器端异常。我希望能够控制异常处理的域名服务水平,这样,当任何操作被称为然后我可以登录例外,敷在一些漂亮的话将它发送给客户端。 我发现许多方面WCF和经典的Web服务,但没有为RIA服务。 请提供您的建议。

I am trying to find out a way to handle unhandled exceptions at server side. I want control over exception handling at Domain Service level so that when any operation is called then I can log the exception and wrap it in some beautiful words to send it to the client. I found many ways for WCF and classic web services but nothing for RIA services. Please provide your suggestions.

推荐答案

您需要重写 DomainService.OnError 方法,在此WCF RIA服务异常处理博客条目。我在一个基地的DomainService类在我的应用做到了这一点,而不是在每一个人的DomainService类,如下图所示。在 errorInfo.Error 属性没有二传手,所以我不认为你可以用自己的替换异常对象,但<的System.Web><的customErrors模式=开/> 配置元素可以prevent异常的细节暴露给客户端

You need to override the DomainService.OnError method as described in this WCF RIA Services Exception Handling blog entry. I've done this in a base DomainService class rather than in each individual DomainService class in my application as shown below. The errorInfo.Error property does not have a setter so I don't think you can replace the exception object with your own, but the <system.web><customErrors mode="On" /> config element can prevent the details of the exception being exposed to the client.

[EnableClientAccess()] public class DomainServiceBase : DomainService { protected override void OnError(DomainServiceErrorInfo errorInfo) { Logger.WriteException(errorInfo.Error); base.OnError(errorInfo); } }

更多推荐

RIA Services服务器端异常处理

本文发布于:2023-11-13 01:41:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583060.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器端   异常   RIA   Services

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!