Hi,
I have a Service that is using the following today
Say that I now need to change this to PerCall instanciated and SessionMode.NotAllowed, is this posible without loosing any of my key functionalitys above?
I have seen that TCP is a session bound protocoll and this means that I will have to use HTTP Binding witch is not as fast as TCP (XML 1.0 encoder instead of Binary encoder). But Im still not sure if this will support for example callbacks?
PerCall and SessionMode.NotAllowed are "less" specific/restrictive than your current setup. You should easily be able to transition to these settings so long as you realize the fundamental implication: no more state in between calls in your service instances.
That said, I'm not sure I understand what you mean by "Singleton on service that holds all the client contexts". Can you elaborate? I think you mean your holding state within a singleton (static field?) in the service implementation. Accessing that from the PerCall instances will be fine, just remember you have to provide the locking around that state. This is, for example, how you could maintain the list of callbacks.
Also, your understanding of TCP being session only is incorrect. Remember, HTTP is a protocol built on top of TCP. Yes TCP sockets stay connected for some amount of time (keep alive) so they can be reused, but the messages you send over them can be completely unrelated to one another. So if you stick with NetTcpBinding you'll be fine. Likewise you can technically do sessions over the HTTP transport. Also, if you switched to an HTTP based transport, you don't have to use text encoding. You can send binary content over the HTTP transport, it just requires setting up a custom binding that would look something like:
<bindings>
<customBinding>
<binding name="MyBinaryOverHttpBinding">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With