开发者

Is using one-way operations in a sessionful contract considered a bad design?

开发者 https://www.devze.com 2023-02-08 15:37 出处:网络
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 contr

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 PerCall instancing because per call instancing uses channel stack for single request processing. As pointed in comment it will happen in PerCall instancing as well because of faulted sessionful channel.

0

精彩评论

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

关注公众号