c# - IParameterInspector and Exception Handling -
in wcf service methods have attribute defined. attribute class inherits attribute & ioperationbehavior , adds iparameterinspector behavior. iparameterinspector instantiated class provides beforecall & aftercall methods.
problem: exceptions raised inside method call beforecall method not caught. have tried couple of solutions including ierror available none of them have worked.
this code: service method:
[operationbehavior] [myauthorization(role = enums.psoroles.dicequote)] public list<employee> getemployee(int eid) { try { return _empservice.getemployee(eid); } catch (exception ex) { _logger.error(ex); throw new faultexception(ex.message, new faultcode(httpstatuscode.internalservererror.tostring())); } } public class myauthorization : attribute, ioperationbehavior public void applydispatchbehavior(operationdescription operationdescription, dispatchoperation dispatchoperation) { dispatchoperation.parameterinspectors.add(new myauthorizationparameterinspector()); } public class myauthorizationparameterinspector : iparameterinspector public object beforecall(string operationname, object[] inputs) { ... } public void aftercall(string operationname, object[] outputs, object returnvalue, object correlationstate) { ... }
thanks help.
Comments
Post a Comment