Is that possible (using behavior and IClientMessageInspector.BeforeSendRequest) to change the comunication channel before send a message ?
I need to change this, because i have a backup/primary strategy for my proxy.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on your comment, it sounds like you want to be able to switch service endpoints in mid-call if the primary service is offline. I don’t think there’s any way to do that – at least not elegantly.
Once a communication channel is established, it’s pretty much set until it is closed (or aborted). There’s no way to switch it from one endpoint to a different (backup) endpoint – you couldn’t even do it by creating a new channel because the proxy would still be using the primary endpoint.
Based on my understanding of WCF, about the closest you could come would be for the client to detect that the primary service was not responding (most likely through a timeout), and then it could switch to a proxy configured for the secondary/backup service.
Now, you might be able to, within
IClientMessageInspector.BeforeSendRequestdo some checking to see if the service is responsive, and if it does not response try to generate a new proxy with the backup service endpoint and send the message there…BUT I don’t know if that would work, and even if it did it strikes me as a bit of a kludge.Simplest solution is that the client simply switches to the alternate service endpoint if the primary endpoint is down, IMO.