开发者

Adding new exception types to the WCF 4 routing service error handling

I am working on a prototype using WCF 4 routing services to create a pass through router, leveraging the error handling functionality

I have a requirement where if a WCF service generates a custom excepti开发者_开发技巧on (in this scenario it is called a notPrimaryException), it should be handled in the same way as a communication exception is handled in WCF4 routing services error handling, that is, the message should be resent to the endpoints in the backup list.

Now I understand that this custom exception is returned from the service to the router as a fault exception at the message layer as opposed to a communication exception being returned at the transport layer.

I have tried using message inspectors and the IErrorHandler interface (ProvideFault and Handle Error) to identify if the notPrimaryException is occurring at the router but nothing is being picked up until it returns to the client as an unhandled fault exception. I was hoping to intercept this fault somewhere on the router and resend the message accordingly but I don't know if there are any appropriate behaviors.

Is there a way to shoehorn additional exception/fault types into the error handling infrastructure or is there another approach I may have overlooked?

Thanks and Regards,

Ivan


You should not be handling application errors on the router. Generally, the application developer has placed FaultExceptions on the service with the expectation of being able to handle them on the client.

If the FaultException is not received by the client, how does the client know what/anything went wrong?

The only errors you should be handling on the router are transport layer exceptions, application exceptions should be handled in the application.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜