Is using one-way operations in a sessionful contract considered a bad design?
I've read that one-way operations shouldn't be used in a sessionful contract if using SessionMode.PerSession instantiation, but it is not a bad design to use one-way operations with sessionful contract when SessionMode is either per-call or per-singleton.
Any ideas why one-way operations shouldn't be used with per-session, while they can b开发者_运维问答e used with per-call and per-singleton?
Thank you
If you use One-Way operation you don't know if it caused exception on the service. Unhandled exception on the service always faults the channel. If InstanceContextMode
is set to PerSession
it faults sessionful channel and it disposes service instance. Because of the one way nature client will not know about it and next call to the service from the same client proxy will end with exception (channel is faulted ...). Client will be only able to call Abort
on the proxy but he will not know about that. IMO Single
instancing with session enabled will behave quite similar except it will not dispose service instance.
This will not happend with As pointed in comment it will happen in PerCall
instancing because per call instancing uses channel stack for single request processing.PerCall
instancing as well because of faulted sessionful channel.
精彩评论