问题
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