问题
in my self-hosted WCF application I've got a problem using port sharing with mono. Given the following code, this exception is thrown:
System.Net.Sockets.SocketException: Address already in use
and here is my code:
NetTcpBinding tcpBinding = new NetTcpBinding();
ServiceHost host1 = new ServiceHost(myService1);
host1.AddServiceEndpoint(typeof(IMyService1Contract), tcpBinding, "net.tcp://192.168.0.70:8075/service1");
host1.Open();
ServiceHost host2 = new ServiceHost(myService2);
host2.AddServiceEndpoint(typeof(IMyService2Contract), tcpBinding, "net.tcp://192.168.0.70:8075/service2");
host2.Open();
I already found this bug report here https://bugzilla.xamarin.com/show_bug.cgi?id=277. Unfortunately there was never a response to the last comment.
Like the person who wrote the report, my code works perfectly fine with windows/.net, but on my linux machine using mono 2.10.8.1 (raspberry pi, soft-float Debian) the mentioned exception occurs.
Thank you very much in advance for your answer!
来源:https://stackoverflow.com/questions/15948639/net-tcp-port-sharing-and-mono