1 Answer
1

The callback won't be maintained indefinitely, It will look for the timeout values you've set in your config. If you enable reliable sessions then you can set the inactivity timeouts of your clients. You can configure timeouts like this:

When these values are reached and there is still no response, your communication channel becomes faulted and you need to re-create a client proxy to consume the service. The default value for receiveTimeout is 10 minutes so you can increase that, but also make sure to increase your inactivityTimeout as well, your inactivityTimeout should be greater than your receiveTimeout.

EDIT:

You could keep changing your receiveTimeout programmatically based on values your client sends back to the server, the key is keeping the new timeout values same on the service and client.
You would go about doing this on the client (an example I'm taking from a chat service I'm making with WCF and consuming with Silverlight clients):

So you can define multiple endpoints or bindings in the config on your client or your server, then based on whatever
event in your application you can instantiate _clientProxyX to consume _serviceInstanceX which will have different binding/endpoint values
but the same contract as your previous service instance. In the example above the first binding has a timeout of 1 minute,
the second binding 2 minutes. An important point to consider is that if you wish to recreate new client proxies like this, then you need to tear down your old client
proxy and crate a new one, which effectively disconnects your clients from the service, at least momentarily.

Also you can modify those values (openTimeout, closeTimeout etc.) programmatically on both the server when instantiating a new service host.
You can create a new host, based on one of the binding configurations you've defined in your config,
or create a new config programmatically, something like this:

This looks quite messy I know, but the point is WCF gives you a lot of flexibility in being able to modify you binding configs programmatically.
Be sure to check out this great answer on modifying your WCF config files. And you can also easily create a whole service configuration programmtically.

I want to handle periodic events, would it be acceptable practice to have a "Keep-Alive" message come from the server every x minutes and set the time out to 2*x?
–
Omar KoohejiMay 14 '12 at 16:52

So you want to keep changing the receiveTimeout based on what your client returns to the server right? I've not done it before but I don't think its necessarily bad practice. Why don't you just set the timeouts to "infinite"? You could also do that programmatically like this: binding.ReceiveTimeout = new TimeSpan(300,0,0,0,0); this will make your receiveTimeout 300 days.
–
Mohammad SepahvandMay 15 '12 at 12:41