问题描述
虽然轮询web服务是可能的,你知道的另一种方法来推动改变移动客户端,除了使用Exchange Server邮件传输的?
Although polling a webservice is possible, do you know of another method to push changes to a mobile client except using the exchange server mail transport?
推荐答案
正如马克·西曼又写道:我曾经做过一个客户通知系统的POC的.NET CF的时候我是在Microsoft Dynamics移动团队
As Mark Seemann worte: I once did a POC of a client notification system for .NET CF when I was in the Microsoft Dynamics Mobile team.
当时我没发现任何超出的现成的解决方案,能做到这一点,我不想搭载了Exchange服务器连接,因为目标用户没有一个AD帐户,最certanly没有使用Exchange服务器。于是我就在同样的情况你现在的样子。我开始寻找可能的解决方案...
At the time I didn't find any Out-Of-The-Box solutions that could do this and I didn't want to piggyback on the Exchange Server connection since the intended users didn't have a AD account and most certanly didn't use the exchange server. So I was in the same situation as you are now. I started searching for possible solutions...
我意识到,服务器coudn't连接到客户端,因为这个IP地址不断的变化(从3G将无线网络,连接松动等)。的clinent不得不连接到服务器。此外,我发现,大多数网络允许通过自定义端口的HTTP连接,但并不总是自定义的TCP连接。
I realised that the server coudn't connect to the client since the IP address of this constantly changes (going from 3G to WiFi, loosing connection, etc). The clinent had to connect to the server. Furthermore I found that most networks allows HTTP connections but not always custom TCP connections over custom ports.
我所用的彗星做从客户端(.NET CF)到服务器长期持有http请求(IIS)和使用该连接推通知给客户端。如果客户端有一个超时被赋予了通知之前,它只会作出新的要求。
I used "Comet" to do long-held http requests from client (.NET CF) to server (IIS) and pushed the notifications to the client using this connection. If the client got a timeout before a notification was given it would simply make a new request.
在服务器端的我用一个AsyncHttpHandler的combnation并等待该检查邮件连接的客户端的每个线程每秒。使用AsyncHttpHandler是很重要的,否则你会阻止IIS服务器。
On the serverside I used a combnation of an AsyncHttpHandler and wait threads that checked for messages to the connected clients every sec. It is important to use a AsyncHttpHandler or you'll block the IIS server.
在POC运作良好,它被证明是一个可靠的解决方案。也有一些缺点:如果你不小心,你会很快耗尽电池
The POC worked well and it proved to be a reliable solution. There are some drawbacks to this: if you are not careful you'll drain the battery quite quickly.
不幸的是仅仅涉及到我在这里发表的code code太多的线路,但如果你喜欢你更是欢迎与我联系,我会通过电子邮件发送你我的POC。
Unfortunately there are simply too many lines of code involved for me to post the code here, but if you like you are more that welcome to contact me and I'll e-mail you my POC.
这篇关于如何将数据推送到一个.NET CF客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!