如何使TCP服务器应用程序中的ASP.NET网站沟通 [英] How to make a ASP.NET website communicate with TCP server application

查看:410
本文介绍了如何使TCP服务器应用程序中的ASP.NET网站沟通的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些在那里一套硬件是通过服务器应用程序(通过TCP套接字进行通信,并更新与硬件相关的数据库)的管理和监测的体系结构。还有一个asp.net网站用户应当通过其能够通过TCP服务器以获得硬件的实时状态。 TCP服务器和网站将在同一台机器上被托管。

I have an architecture where some set of hardware is administered and monitored through a server application (communicating through TCP Sockets and also updating database related to hardware). There is also an asp.net website through which a user should be able to get the realtime status of the hardware through the tcp server. the tcp server and the website will be hosted on the same machine.

我的问题是如何让用户与TCP服务器进行交互?

My question is how can I make the USER interact with the TCP SERVER?

我碰到是使在这一个窗口服务和主机WCF TCP服务器,使asp.net网站消费这种服务的一种方法。但因为我是一个新手总,我困惑了。所以,请告诉我,如果这个解决方案适用于我的问题。而如果是请详细说明如何可以完成的。

One way I came across was to make the tcp server in a windows service and host wcf in it and make asp.net website to consume this service. But as I am a total newbie, I am confused about it. So please tell me if this solution is applicable to my problem. and if it is please elaborate how it can be done.

推荐答案

这是可能实现的一个。
由于您的应用程序(IIS托管的网站和Windows服务应用程序)是在同一台机器上,你应该使用NetNamedPipeBinding(因为它是可用单台机器上最快的WCF通信)。

This is one of possible realizations. Since your applications (IIS hosted web site and Windows Service application) are on the same machine you should use NetNamedPipeBinding (because it is the fastest WCF communication available on single machine).

有其他方式的HTTP应用程序和Windows服务之间的通信,但是这一个是快速,可靠和非常容易实现。我当然woud做这样的。

There are other ways to communicate between your HTTP application and Windows Service but this one is fast, reliable and quite easy to implement. I certainly woud do this this way.

这篇关于如何使TCP服务器应用程序中的ASP.NET网站沟通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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