[Mono-dev] Self Hosted web service unstable – we see a new active port connection for each call

Vilius Adamkavicius vilius.adamkavicius at invade.net
Fri May 7 11:14:52 EDT 2010

We have implemented a simple self hosted web service in .NET using
ServiceHost.  The Client is a simple Silverlight app that polls for updated
info every 5 seconds. The return messages tend to be no more that 1-10K.

 We ported the web service (self-hosted)  to MONO 2.6. This seemed to go
perfectly and it stood up to stress testing in devel...then we deployed it.
Now we find that the service is unstable and can just hangs after anywhere
between 2 minutes and 2 days.

IP traces show that when it hangs the XML Post gets (request) gets received
by the webservice but nothing is ever transmitted back.  Also when it hangs
netstat shows a persistent active connection on the port to which it is

In an attempt to diagnose this we looked at the port behaviour using
netstat. We looked at this while the MONO implementation of the webservice
was running without problem; we compare this to the active port connection
behaviour of the windows/.NET implementation- what found was worrying.

When we run a single client and connect the windows/.NET version of the
webservice we see *one port connection that persists*.

When we run a single client and connect the MONO version of the webservice
we see it holds around *12-16 active port connections at any one time*...and
these seem to be continuously dying and regenerating.

We postulated that each call to the webservice was making a new connection
(unlike Windows); each connection would be used once and then timeout. Given
the rate that the client polls we estimated that the timeout must be around
a minute...then we found this in the MONO DefaultCommunicationTimeouts.cs

Vilius: private DefaultCommunicationTimeouts ()
close = open = send = TimeSpan.FromMinutes (1);
receive = TimeSpan.FromMinutes (10);

This strongly supports our theory...

The question is why does it keep creating a new connection for each call?
Can the MONO 2.6 implementation of ServiceHost maintain a single connection
for an application session (like Windows .NET) ? What is the ramification of
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100507/fd52c85d/attachment.html 

More information about the Mono-devel-list mailing list