WCF - 紧凑框架 - 从移动客户端提取数据

发布于 2024-09-02 04:08:12 字数 607 浏览 3 评论 0原文

我想将 xml 序列化对象从服务器传输到客户端,反之亦然。现在(可能)很容易使用 WCF 从移动客户端(紧凑框架)调用方法,但是有没有办法让服务器可以调用客户端的方法或其他方式从客户端提取数据?我知道回调合约在紧凑框架中不可用,如下所示: http://blogs.msdn.com/andrewarnottms/archive/2007/09/13/calling- wcf-services-from-netcf-3-5-using-compact-wcf-and-netcfsvcutil-exe.aspx

本来我想到的是套接字编程并自己开发这个,然后这里有人提到了WCF。但似乎 WCF 只能在非移动环境中工作,因为我需要回调。

任何人都可以帮我解决这个问题吗?是否可以使用 WCF 开发与桌面服务器和多个移动客户端的双向通信,或者我必须进行套接字编程?

感谢您的任何建议或任何形式的帮助!

I want to communicate xml serialized objects from the server to the client and the other way arround. Now it is (probably) easy to invoke methods from a mobile client (compact framework) using WCF, but is there a way so that the server can invoke methods on the client side or some other way to pull data from the client? I know that callback contracts are not available in the compact framework as you can see here: http://blogs.msdn.com/andrewarnottms/archive/2007/09/13/calling-wcf-services-from-netcf-3-5-using-compact-wcf-and-netcfsvcutil-exe.aspx

Originally I thought of socket programming and of developing this by myself, then someone here mentioned WCF. But it seems like WCF only would work in a non mobile environment as I need callbacks.

Anyone can help me with this? Is it possible to develop a two way communication with a desktop server and multiple mobile clients using WCF, or will I have to do socket programming?

Thanks for any advice or any kind of help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

在梵高的星空下 2024-09-09 04:08:12

在 ctacke

感谢您的帮助。事实上,我之前偶然发现了你们的 Padran Web 服务器。还没有真正检查过它。但我以后肯定会这样做。不管怎样,套接字解决方案目前看起来还不错。与此同时,我发现将多个客户端的数据发送到“套接字服务器”是相当容易的。如果我能以某种方式管理这些连接,我就可以将数据发送回客户端。然后我必须想出某种协议来处理我通过网络发送的数据或命令...我想最困难的部分是编写这样一个协议,因为我对那个自动取款机一无所知...

at ctacke

Thank you for your help. I actually stumbled across your Padran web server before.Havent really checked it out yet. But I definitely will do that later on. Anyway, a socket solution does not seem that bad at the moment. In the meanwhile I figured that it is quite easy to send data from multiple clients to a 'socket server'. If I can manage those connections somehow I can send data back to the clients. And then I would have to come up with some kind if protocol which handles the data or commands I send over the network... I guess the hardest part would be to make up such a protocol as I do not have a clue about that atm...

海未深 2024-09-09 04:08:12

即使您使用套接字,由于路由、运营商过滤和 NAT 转换,它可能会有点困难(您没有提到您的实际网络拓扑是什么)。这就是大多数移动应用程序必须轮询服务器的原因,即使它是“推送”范例(如 Exchange 的推送机制,客户端实际上进行轮询)。

一般来说,除非您使用的是本地无线网络之类的网络,并且具有可靠、可路由、未经过滤的网络访问,否则客户端应定期调用服务器并询问服务器是否有数据。如果是,则会从服务器提取数据。

编辑

现在我们从您的评论中对您的拓扑有了更多了解,我可以为您提供更多指导。遗憾的是,Microsoft 并未让 Windwos CE 设备轻松托管服务(WCF 或其他)。理论上,需要构建自己的 WCF 通道并实际托管服务所需的基础设施,但这不是一项简单的任务。我很久以前就研究过这个问题,认为这是几个月的工作,并且需要雷蒙德某个了解现有 Exchange 渠道如何运作的人的帮助。

就我个人而言,我会选择使用 我们的 Padarn Web 服务器 托管基于 REST 的 Web 服务,因为它很容易这样做,我现在已经为相当多的客户这样做了。我意识到提出 Padarn 作为解决方案有点自私,但我在 Padarn 中实现自定义 IHttpHandlers 的全部原因是因为我找不到任何其他东西可以真正为 CE 设备提供任何简单的方法来托管它自己的服务,这是我们经常需要提供解决方案的问题。

其他选项是诸如专有套接字解决方案之类的东西,在设备上托管 FTP 服务器,使用(令人厌恶的,IMO)MS 提供的带有 ISAPI、Telnet 或类似内容的 HTTP 服务器。所有这些看起来要么是黑客,要么是大量工作,要么两者兼而有之。

Even if you go to sockets it might be a bit difficult due to routing, carrier filtering and NAT translations (you've not mentioned what your actual network topology is). This is the reason that most mobile applications have to poll the server, even if it is a "push" paradigm (like Exchange's push mechanism, where the client actually polls).

Generally speaking, unless you're on something like a local wireless network where you have solid, routable, unfiltered network access, the client should periodically call the server and ask if the server has data. If it does, then it pulls the data from the server.

EDIT

Now that we know a little more about your topolgy from your comment, I can steer you a little more. Unfortunately Microsoft has not made it easy for Windwos CE devices to host services (WCF or otherwise). There is, in theory, the required infrstructure to build up your own WCF channel and actually host a service, but it's not a trivial task. I looked into it quite some time ago and figured it was a couple months of work and that would have been with the assistance of someone in Redmond that knew how the existing Exchange channel works.

Personally I'd opt for hosting a REST-based web service using our Padarn web server because it's simple to do and I've done it for quite a number of clients now. I realize that it's a little self-serving to propose Padarn as a solution but the entire reason I implemented custom IHttpHandlers in Padarn was because I couldn't find anything else out there that really provided any easy way for a CE device to host it's own services and it's a problem we often have to provide a solution for.

The other options would be things like a proprietary socket solution, hosting an FTP server on the device, using the (abhorrent, IMO) MS-provided HTTP server with ISAPI, Telnet or something along those lines. All of them seem either a hack, a lot of work or both.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文