如何从与桌面交互的应用程序窗口服务沟通? [英] How to communicate with a windows service from an application that interacts with the desktop?

查看:191
本文介绍了如何从与桌面交互的应用程序窗口服务沟通?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET什么是与服务进行交互的最佳方式(即怎么做最托盘的应用程序与服务器进行通信)。这将是pferred如果这种方法是跨平台以及$ P $(单声道工作,所以我想远程处理了?)

With .Net what is the best way to interact with a service (i.e. how do most tray-apps communicate with their servers). It would be preferred if this method would be cross-platform as well (working in Mono, so I guess remoting is out?)

忘了提,我们还是要支持Windows领域2000的机器,所以WCF和任何高于NET 2.0不会飞。

Forgot to mention, we still have to support Windows 2000 machines in the field, so WCF and anything above .Net 2.0 won't fly.

推荐答案

请注意,如果您正计划最终部署在Windows Vista或Windows Server 2008中,许多方面,这可能今天做是行不通的。这是因为引入了被称为会话0隔离的新的安全功能。

Be aware that if you are planning to eventually deploy on Windows Vista or Windows Server 2008, many ways that this can be done today will not work. This is because of the introduction of a new security feature called "Session 0 Isolation".

多数窗口服务已经移动到会话0现在为了正确地从系统的其余部分隔离它们运行。这方面的一个扩展是第一用户登录到系统不再被置于会议#0,它们被放置在会话1,因此​​,隔离将打破code表示的确某些通信类型的服务之间桌面应用程序。

Most windows services have been moved to run in Session 0 now in order to properly isolate them from the rest of the system. An extension of this is that the first user to login to the system no longer is placed in Session #0, they are placed in Session 1. And hence, the isolation will break code that does certain types of communication between services and desktop applications.

今天写code,将工作在Vista和Server 2008向前发展的服务和应用程序之间做沟通的时候,最好的办法是使用诸如RPC,命名管道,等一个适当的跨进程API不要使用SendMessage函数/ PostMessage的,因为他们会在会话0隔离失败。

The best way to write code today that will work on Vista and Server 2008 going forward when doing communication between services and applications is to use a proper cross-process API like RPC, Named Pipes, etc. Do not use SendMessage/PostMessage as that will fail under Session 0 Isolation.

<一个href="http://www.microsoft.com/whdc/system/vista/services.mspx">http://www.microsoft.com/whdc/system/vista/services.mspx

现在,给你的要求,你要成为一个有点咸菜。对于跨平台的担忧,我不知道是否会远程支持。您可能需要下拉,一路回插座:<一href="http://msdn.microsoft.com/en-us/library/system.net.sockets.aspx">http://msdn.microsoft.com/en-us/library/system.net.sockets.aspx

Now, given your requirements, you are going to be in a bit of a pickle. For the cross-platform concerns, I'm not sure if Remoting would be supported. You may have to drop down and go all the way back to sockets: http://msdn.microsoft.com/en-us/library/system.net.sockets.aspx

这篇关于如何从与桌面交互的应用程序窗口服务沟通?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆