KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following planned architecture for my WCF client library: using ChannelFactory instead of svcutil generated proxies because I need more control and also I want to keep the client in a separate assembly and avoid regenerating when my WCF service changes need to apply a behavior with a message inspector to my WCF endpoint, so each channel is able to send its own authentication token my client library will be used from a MVC front-end, so I'll have to think about possible threading issues I'm using .NET 4.5 (maybe it has some helpers or new approaches to implement WCF clients in some better way?) I have read many articles about various separate bits but I'm still confused about how to put it all together the right way. I have the following questions: as I understand, it is recommended to cache ChannelFactory in a static variable and then get channels out of it, right? is endpoint behavior specific to the entire ChannelFactory or I can apply my authentication behavior for each channel separately? If the behavior is specific to the entire factory, this means that I cannot keep any state information in my endpoint behavior objects because the same auth token will get reused for every channel, but obviously I want each channel to have its own auth token for the current user. This means, that I'll have to calculate the token inside of my endpoint behavior (I can keep it in HttpContext, and my message inspector behavior will just add it to the outgoing messages). my client class is disposable (implements IDispose). How do I dispose the channel correctly, knowing that it might be in any possible state (not opened, opened, failed ...)? Do I just dispose it? Do I abort it and then dispose? Do I close it (but it might be not opened yet at all) and then dispose? what do I do if I get some fault when working with the channel? Is only the channel broken or entire ChannelF
Tags (comma-separated)
Save Edits
Cancel