I am developing WCF service which is connected with weighbridge. We would like to send messages to all connected clients when weight changed. With one weighbridge can be connected only one client so I have developed WCF which communicate with clients by wsDualHttpBinding and callbacks.
This solution works, but after long time(1-2 days) WCF service stop sending callbacks. I known my Service works because I have logger - but my clients don't receive callbacks. My service also don't throw exceptions.
It is my service pseduo code
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant, InstanceContextMode = InstanceContextMode.PerSession)]
public sealed class WeightbridgeService : IWeightbridgeService, IDisposable
public WeightbridgeService()
{
this.callback = OperationContext.Current.GetCallbackChannel<IWeightbridgeServiceCallback>();
weighbridge.WeightChanged += WeightChangedEventHandler;
timer.Elapsed += TimerOnElapsed;
timer.Start();
}
private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
{
timer.Stop();
this.callback.SendWeightData(this.weightData);
timer.Start();
}
and config
<bindings>
<wsDualHttpBinding>
<binding name="longTimeoutBinding" receiveTimeout="00:45:00" sendTimeout="00:45:00" openTimeout="00:45:00" closeTimeout="00:45:00" >
<reliableSession inactivityTimeout="00:45:00" />
<security mode="None"/>
</binding>
</wsDualHttpBinding>
</bindings>
Could you help me what i have done wrong ? I can't find solution for it.
You can add the receiveTimeout attribute to your binding in your SERVICE config file. Although its name is receiveTimeout, it is the value (amount of time) used by the server to close connections for "inactive" clients.
Example: