开发者

WCF REST + Windsor error handling

开发者 https://www.devze.com 2022-12-22 09:31 出处:网络
I want to handle application\'s internal exceptions in a consistent way so that REST web services return errors in a RESTful way.

I want to handle application's internal exceptions in a consistent way so that REST web services return errors in a RESTful way.

I'm using Castle's WCF integration and I couldn't 开发者_开发百科find any good sources on how to do handle errors using WcfIntegration.WindsorServiceHostFactory. The only solution that comes to mind is to use Castle's interceptors on web service methods to catch "internal" exceptions and translate them to HTTP response properties (for example: KeyNotFoundException would be translated to 404 Not Found status code).

Are there any better ways? Thanks.


What about standard WCF IErrorHandler ?


Check out my answer to this question. I think the reason for the HttpContext.Current being null may be related.

0

精彩评论

暂无评论...
验证码 换一张
取 消