Exception handling in RIA Service

后端 未结 3 1344
长情又很酷
长情又很酷 2021-02-19 07:20

As you know, it\'s recomended handle exceptions using FaultException with standard WCF service to hide exception details. That\'s fine but i\'m having problem with WCF Ria servi

3条回答
  •  余生分开走
    2021-02-19 08:05

    Code example:

    [EnableClientAccess()]
    public class YourDomainService : DomainService
    {
        protected override void OnError(DomainServiceErrorInfo errorInfo)
        {
                base.OnError(errorInfo);
    
                customErrorHandler(errorInfo.Error);
        }
    
        private void customErrorHandler(Exception ex)
        {
                DomainServiceContext sc = this.ServiceContext;
    
                //Write here your custom logic handling exceptions
        }
    }
    

提交回复
热议问题