如何在 Web 服务器和站点服务器之间建立 2 路通信? [英] How to establish 2-way communication between a web server and a site server?

查看:28
本文介绍了如何在 Web 服务器和站点服务器之间建立 2 路通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计划一个 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:

  1. 在云中的静态 IP 网络服务器上将有一个网络应用程序,所有客户端都通用.
  2. 在每个客户的办公室内都有另一个应用程序,安装在带有 IIS 的服务器上.

该站点应用程序显然能够连接到该网站上发布的网络服务.但这里有问题 - 我还希望网络应用程序能够启动与站点应用程序的连接......并且现场服务器可能不一定具有静态 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?

我可以让网站应用每隔一分钟左右签入"网络,让网络应用有可能响应当你在这里时,请执行 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 此处.值得点击并阅读他要说的内容...

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 服务器和站点服务器之间建立 2 路通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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