如何建立一个Web服务器和一个站点服务器之间双向通信? [英] How to establish 2-way communication between a web server and a site server?
问题描述
我策划一个SaaS系统中,被写在C#,ASP.NET使用WCF有两个独立的部分组成:
I am planning a SaaS system, to be written in C#, ASP.NET using WCF that has two separate components:
- 在云中的一个静态IP网络服务器将是一个Web应用程序,共同为所有客户端。
- 在每个客户的办公室将是另一个应用程序,安装了IIS的服务器上。
该网站的应用程序显然将能够连接到在网站上发布的Web服务。但是,这里有个致命的 - 我也想了web应用程序能够启动该网站的应用程序的连接...和现场服务器可能不一定有静态IP。我无法控制这一点,因为我们可能会在将来的某个时候有上百个客户,我们不能坚持客户有固定IP的服务器限制我们的适销性。
The site app will obviously be able to connect to the web services published on the web site. But here's the rub - I also want the web app to be able to initiate a connection to the site app... and the on-site server may not necessarily have a static IP. I can't control this, because we may have hundreds of clients at some point in the future, and we cannot limit our saleability by insisting that the customer has a server with fixed IP.
那么,如何才能做到这一点?
So, how to do this?
我可以在网站的应用程序与Web每一分钟左右的登记,给Web应用程序带有而你在这里,请你的 X,Y,Z反应的可能性。 .. 的,但似乎非常不雅。此外,如果我们谈论的数百家客户,我不希望被轰击我的Web服务器所有这些你好!消息如果他们没有实际需要。
I could have the site apps "checking in" with the web every minute or so, to give the web app the possibility of responding with a "while you're here, please do x,y,z..." but that seems very inelegant. Also, if we're talking about hundreds of clients, I don't want to be bombarding my web server with all these "hi there!" messages if they're not actually required.
有没有更好的办法?
推荐答案
在最后,我决定去与NetTcpBinding的,由@Allon Guralnek <一个最好的说明理由href=\"http://stackoverflow.com/questions/4526284/connecting-over-internet-to-wcf-service-using-wsdualhttpbinding-times-out/4528171#4528171\">here.这是值得通过点击和阅读他有什么要说...
In the end I decided to go with NetTcpBinding, for reasons best given by @Allon Guralnek here. It's worth clicking through and reading what he has to say...
这篇关于如何建立一个Web服务器和一个站点服务器之间双向通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!