OSX上的单声道WCF问题

时间:2011-01-02 21:01:19

标签: c# wcf macos mono

我编写了一个单声道兼容的应用程序,可以在Windows机器上正常工作,并且主要在我的Mac上工作。当前不起作用的区域是使用WCF(ChannelFactory)在服务器和客户端之间进行通信的层。

问题似乎是当我尝试在服务器上打开ChannelFactory时,这是一段代码片段:

string address = "21"; // added this for simplicity in conveying the problem...
string server_address = "net.tcp://192.168.1.122:4505/DeviceServer/";
string serviceAddress = string.Format(server_address, address);

ThreadedServiceHost<DeviceService, IDeviceContract> DeviceHost =
            new ThreadedServiceHost<DeviceService, IDeviceContract>(serviceAddress, address, new NetTcpBinding());

EndpointAddress endPoint = new EndpointAddress(
                     new Uri(string.Format(serviceaddress, address) + address));

System.ServiceModel.Channels.Binding binding = new NetTcpBinding();

teeGlobal.ServerDeviceFactory = new ChannelFactory<IDeviceChannel>(binding, endPoint);
teeGlobal.ServerDeviceFactory.Open();

问题在于.Open()调用 - 它似乎挂在我的mac上。创建端点比在我的PC上创建需要更长的时间(大约3-4秒),但如果我可以让WCF层运行,我可以忍受这个。

有人对如何处理此问题有任何建议吗?

1 个答案:

答案 0 :(得分:2)

Mono的最新稳定版本是2.8.2(http://www.go-mono.com/mono-downloads/download.html)

在执行任何其他操作之前,您确实需要尝试使用此版本。 2.6.x中的WCF堆栈比其他任何东西都更像是“预览”,只有一些常见的场景才有效。 2.8更加完整。

相关问题