gpt4 book ai didi

c# - OSX 上的 Mono WCF 问题

转载 作者:行者123 更新时间:2023-11-30 17:19:50 24 4
gpt4 key购买 nike

我编写了一个兼容单声道的应用程序,它在 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 层正常运行,我可以忍受这一点。

有人对如何解决这个问题有任何建议吗?

最佳答案

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

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

关于c# - OSX 上的 Mono WCF 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4580502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com