GUI和窗口服务的通信窗口、通信、GUI

2023-09-02 21:22:29 作者:心之所向便是光

我知道,因为Vista的,那C#不能直接到窗口服务挂钩的UI形式。这是说在微软网站。

I know since Vista, that C# can't hook a UI form directly to the windows service. This was stated on the Microsoft Site.

我在这方面的问题是:什么是沟通从UI到服务的最佳模式

My question in this regard is: "What is the best mode of communication from a UI to the service?"

我听说远程,Web服务和直接TCP的。还有没有其他的方法呢?他们如何排名对previously提到的方法?如何复杂是他们实现?

I have heard of Remoting, Web services, and direct TCP. Are there other methods? How do they rank against the previously mentioned methods? How complicated are they to implement?

我的应用是企业内部网的使用,而不是互联网。微软平台将两边,因此互操作性是不是一个因素,而且速度。我的意思是我要在整个最小包来获得尽可能在网络上。

My application is for intranet use, not internet. Microsoft platform will be on both sides, so interoperability is not a factor, but speed is. I mean I want to get across the smallest packet possible on the network.

TIA

推荐答案

如果你打算用.NET开发,使用的 WCF 您的进程间通信。 WCF极大地简化了开发,因为与一个特定的通信机制(例如,插座,管道等)相关联的复杂性被抽象背后一个统一的编程模型。因此,它并不重要,如果您选择使用HTTP,TCP或命名管道的传输机制无所谓,编程模型是一样的。

If you are going to be developing with .NET, use WCF for your interprocess communication. WCF greatly simplifies development because the intricacies associated with a specific communication mechanism (e.g., sockets, pipes, etc.) are abstracted behind a unified programming model. Thus, it doesn't matter if you choose to use http, tcp, or named pipes for your transport mechanism, the programming model is the same.

我会强烈建议Juval洛伊的书的编程WCF服务的万物WCF 。您也可以访问他的网站, IDesign.net ,免费WCF code样本。

I would highly recommend Juval Lowy's book Programming WCF Services for all things WCF. You can also visit his website, IDesign.net, for free WCF code samples.

有关WCF的概述,看这个免费影片在dnrTV。它涵盖WCF的目的,并通过一些容易遵循的例子演示了WCF编程。

For an overview of WCF, watch this free video at dnrTV. It covers the purpose of WCF and demonstrates WCF programming through some easy-to-follow examples.

如果您尚未创建您的Windows服务,但计划这样做在C#中,你可以按照一步一步的here.

If you have not already created your Windows service but plan to do so in C#, you can follow the step-by-step here.