How to make a ASP.NET website communicate with TCP server application

穿精又带淫゛_ 提交于 2019-12-11 12:00:10

问题


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.

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

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.


回答1:


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).

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.



来源:https://stackoverflow.com/questions/10754255/how-to-make-a-asp-net-website-communicate-with-tcp-server-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!