简体   繁体   English

在SERVICE和Web /桌面应用程序之间进行通信

[英]Communicating between SERVICE and web/desktop application

Whats the recommended way to communicate between a service and a desktop app or webpage ? 什么是推荐的服务和桌面应用程序或网页之间的通信方式?

I want the service to do all the work, but admin/management/reporting to be possible via web or desktop. 我希望该服务能够完成所有工作,但管理/管理/报告可通过网络或桌面进行。 (It will be written in C# with .Net 4.0) (它将用C#编写.Net 4.0)

Is it named pipes ? 它命名为管道吗? sockets ? 插座? wcf ? wcf? rest ? 休息? soap ? 肥皂 ? other ? 其他? What is best practice ? 什么是最佳做法?

Any info would be greatly appreciated. 任何信息,将不胜感激。

The service needs to be effectively real time so any comms need to be async. 该服务需要实时有效,因此任何通信都需要异步。

Thanks Andrew 谢谢Andrew

UPDATE 1 - The service monitors network traffic REALTIME as a service. 更新1 - 服务监视网络流量REALTIME即服务。 The client could be local or could be remote (using ASP.NET/MVC or even silverlight). 客户端可以是本地的,也可以是远程的(使用ASP.NET / MVC甚至Silverlight)。 The client doesn't need realtime data, but should be abe to query SETTINGS, Statistics, Logs, etc.. 客户端不需要实时数据,但应该查询SETTINGS,Statistics,Logs等。

If both ends of the code are controlled then, barring any specific requirements, I'd opt for WCF because "it's so darn simple". 如果代码的两端都受到控制,那么除非有任何特定的要求,否则我会选择WCF,因为“它太简单了”。

See Choosing a (WCF) Transport : it's easy to go from HTTP to TCP to Named Pipes (ooo la la!): 请参阅选择(WCF)传输 :从HTTP到TCP到命名管道(ooo la la!)很容易:

A named pipe is an object in the Windows operating system kernel, such as a section of shared memory that processes can use for communication [read: very fast ]. 命名管道是Windows操作系统内核中的对象,例如进程可用于通信的共享内存部分 [read: very fast ]。 A named pipe has a name, and can be used for one-way or duplex communication between processes on a single machine . 命名管道具有名称,可用于单台机器上的进程之间的单向或双工通信。

Of course, if the same machine requirement is violated, then HTTP/TCP can be used instead depending upon network configuration, etc -- difference to code? 当然,如果违反了相同的机器要求 ,则可以使用HTTP / TCP,具体取决于网络配置等 - 与代码的区别? A configuration setting :) 配置设置:)

Happy coding. 快乐的编码。

The question is asked as WCF or HTTP or TCP. 该问题被称为WCF或HTTP或TCP。 WCF is an extremely flexible communications foundation. WCF是一个非常灵活的通信基础。 You can write your code once and decorate your data classes and on the fly switch via configuration and code between HTTP JSON/POX, TCP, Binary, Binary over HTTP, custom serialization etc... The question as to which transport mechanism you choose is based on routing/firewall limitations, clients etc... Personally, I like diagnosable transports like HTTP and JSON/XML just because how universal, routable, and diagnosable they are (checkout fiddler2). 您可以编写一次代码并通过HTTP JSON / POX,TCP,二进制,二进制HTTP,自定义序列化等之间的配置和代码来装饰您的数据类和动态交换机...您选择的传输机制的问题是基于路由/防火墙限制,客户端等......就个人而言,我喜欢HTTP和JSON / XML之类的可诊断传输,因为它们具有通用性,可路由性和可诊断性(checkout fiddler2)。

From your description, it seems like the tough part of the problem is REALTIME network traffic monitoring which the service performs. 根据您的描述,问题的严重部分似乎是服务执行的REALTIME网络流量监控。 The channel between the client and that service seems like the simpler part of the problem. 客户端和该服务之间的通道似乎是问题的简单部分。

Also from the description, the client doesn't need to be REAL TIME and is simply querying statistics, settings and logs. 同样从描述中,客户端不需要是实时的,只是查询统计信息,设置和日志。 Because the client can be local or remote (remote implying possibly outside the intranet? routing externally). 因为客户端可以是本地的或远程的(远程暗示可能在Intranet外部?外部路由)。

Because of that, I would decouple the REALTIME network statistics gathering process from the querying portion which makes it async as you mentioned. 因此,我会将REALTIME网络统计信息收集过程与查询部分分离,这使得它与您提到的异步相同。 At that point, the service is simply opening a channel to the clients to query simple stats, settings and logs ... choose the most routable and diagnosable channel like HTP, REST JSON|XML. 此时,该服务只是打开一个通向客户端的通道来查询简单的统计信息,设置和日志......选择最可路由和可诊断的通道,如HTP,REST JSON | XML。 If that's a problem, keep your WCF server code intact and change the WCF bindings configuration. 如果这是一个问题,请保持WCF服务器代码不变并更改WCF绑定配置。

The question is a bit open ended and ambiguous but hopefully that helps a bit. 问题有点开放和含糊不清,但希望这有点帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在模拟器上部署的WP 7应用程序和桌面应用程序之间进行通信 - Communicating between WP 7 Application deployed on a emulator and a desktop application Web应用程序和Xamarin.Android应用程序与服务/ API通信 - A web application and Xamarin.Android app communicating to a Service/API 在桌面应用程序和Web应用程序之间是可能的 - is sso posible between Desktop application and web application apache网页和mono应用程序之间通信的框架 - framework for communicating between apache web page and mono application .Net桌面应用程序和ASP.NET Web应用程序之间的通信 - Communication between .Net Desktop Application and ASP.NET Web application Web应用程序与桌面应用程序之间的双向通信 - Two-way communication between web application and desktop application SAAS / Cloud Web应用程序和桌面应用程序之间的共享身份验证 - Shared Authentication between SAAS/Cloud web application and Desktop application .Net桌面应用程序和Web应用程序之间的技术区别是什么? - What are the technical difference between .Net desktop application and web applications? 在Windows服务和Exchange Server之间进行通信 - Communicating between a Windows Service and Exchange Server .NET Web服务与Web服务应用程序之间的区别(不是Web应用程序或WCF服务应用程序) - Difference between .NET Web Service & Web Service Application (NOT Web-Application OR WCF Service App)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM