Mono WCF NetTcp service accepts only one client at a time

While trying to create a WCF client-server application in Mono, we encountered some problems. Having reduced it to a simple example, we found that the service only accepts one customer at a time. If another client tries to connect, it freezes until the first one disconnects.

A simple change to BasicHttpBinding fixes it, but we need NetTcpBinding for duplex communication. Also, the problem does not occur if compiled in MS.NET.

EDIT: I doubt (and hope not) that Mono doesn't support what I'm trying to do. Mono code usually throws NotImplementedExceptions in such cases, as far as I noticed. I am using Mono v2.6.4

Here's how the service opens in our base case:

public static void Main (string[] args) { var binding = new NetTcpBinding (); binding.Security.Mode = SecurityMode.None; var address = new Uri ("net.tcp://localhost:8080"); var host = new ServiceHost (typeof(Hello)); host.AddServiceEndpoint (typeof(IHello), binding, address); ServiceThrottlingBehavior behavior = new ServiceThrottlingBehavior () { MaxConcurrentCalls = 100, MaxConcurrentSessions = 100, MaxConcurrentInstances = 100 }; host.Description.Behaviors.Add (behavior); host.Open (); Console.ReadLine (); host.Close (); } 

The client channel is obtained as follows:

 var binding = new NetTcpBinding (); binding.Security.Mode = SecurityMode.None; var address = new EndpointAddress ("net.tcp://localhost:8080/"); var client = new ChannelFactory<IHello> (binding, address).CreateChannel (); 

As far as I know, this is a Simplex connection, right?

The contract is simple:

 [ServiceContract] public interface IHello { [OperationContract] string Greet (string name); } 

The service implementation does not have ServiceModel tags or attributes.

I will update the necessary data.

+6
mono wcf nettcpbinding
source share
2 answers

I played around a bit with this and it definitely looks like a Mono bug.

I am porting a WCF application to run in Mono at the moment. I played with some NetTcpBinding materials, but I have not tried this scenario (multiple host connections with Mono host support). However, now I will try, I can reproduce - both in version 2.6, and in the last daily package.

However, it works in .NET. Any difference in behavior between Mono and .NET is classified as a bug. You have to register it with Bugzilla with a test case, I would also publish it in the Mono news list.

Good luck.

+3
source share

Definitely a mistake. I am wondering if there was a version on which it worked correctly ...

I posted it on Novell Bugzilla if you are interested in its progress.

+1
source share

All Articles