[英]How to communicate from Azure web app to WCF services hosted locally in IIS?
I have an ASP.NET MVC application hosted in Azure. 我在Azure中托管了一个ASP.NET MVC应用程序。 This application is complemented with a desktop application that also has WCF services for communicating with III party interfaces.
此应用程序补充有一个桌面应用程序,该应用程序还具有用于与第三方接口进行通信的WCF服务。 WCF are hosted locally.
WCF在本地托管。
There are thousands of clients using the desktop application at different geographical locations. 有成千上万的客户端在不同地理位置使用桌面应用程序。 Till now, every desktop application used to talk to web app using api with the help of WCF.
到目前为止,每个桌面应用程序都曾经在WCF的帮助下使用api与Web应用程序进行通信。 This was limited to on demand from the desktop application.
这仅限于桌面应用程序的需求。 Whenever desktop application feels the need to talk to web app, it used the way of web api from WCF.
每当桌面应用程序需要与Web应用程序通信时,它都会使用WCF中的Web API。
Now, what I want is:- To access the different desktop applications(typically called sites), from azure depending upon the need. 现在,我想要的是:-根据需要从天蓝色访问不同的桌面应用程序(通常称为站点)。 This is required on account of an online ordering system that is through web app/mobile app.
由于通过Web应用程序/移动应用程序的在线订购系统,因此需要此功能。 I do not want to keep polling from desktop application to know about if any new order is there for this site.
我不想继续从桌面应用程序轮询以了解该站点是否有任何新订单。 I feel it would be better if I can play from other side.
我觉得如果我能从另一边打球会更好。 Also, keeping in mind that IP of sites will not be fixed.
另外,请记住,站点IP不会固定。 There may be issue with firewall.
防火墙可能有问题。 NAT may translate resource identifier differently.
NAT可能会转换资源标识符的方式有所不同。
Can service bus in azure may be of any help, but what confuses me is that every desktop application is having its own WCF service and order should reach the respective site only. 天蓝色的服务总线可能会有所帮助,但令我感到困惑的是,每个桌面应用程序都具有自己的WCF服务,并且订单应仅到达各自的站点。
Any type of ideas on this would be appreciated. 任何形式的想法,将不胜感激。
According to your description, Service Bus messaging is a perfect way to achieve this. 根据您的描述,服务总线消息传递是实现此目标的理想方法。
More information about Service Bus Messaging, we can refer to: Service Bus queues, topics, and subscriptions 有关服务总线消息传递的更多信息,我们可以参考: 服务总线队列,主题和订阅
In addition, We can also use RabbitMQ
or ZeroMQ
which is similar with Service Bus Messaging because both of them are free. 此外,我们还可以使用与服务总线消息传递类似的
RabbitMQ
或ZeroMQ
,因为它们都是免费的。 You can choose an best way to realize your requirements. 您可以选择实现需求的最佳方法。
About differences between ZeroMQ and RabbitMQ: 关于ZeroMQ和RabbitMQ之间的区别:
ZeroMQ has better performance, but it is built in the case of allowing message data loss to apply to high throughput / low latency applications. ZeroMQ具有更好的性能,但它是在允许消息数据丢失应用于高吞吐量/低延迟应用程序的情况下构建的。 Unlike ZeroMQ, RabbitMQ fully implements the AMQP protocol, which is similar to mailbox services, supporting message persistence, transaction, congestion control, load balancing and so on, making RabbitMQ have a more extensive application scenario.
与ZeroMQ不同,RabbitMQ完全实现了AMQP协议,该协议类似于邮箱服务,支持消息持久性,事务,拥塞控制,负载平衡等,使RabbitMQ具有更广泛的应用场景。
Function RabbitMQ ZeroMQ
Message persistence Support Not Support
Transaction Support Not Support
performance Low High
stability High Low
Support for AMQP protocol Support Not Support
Application scenario Data loss is not allowed High throughput
More information about RabbitMQ and ZeroMQ, we can refer to: 有关RabbitMQ和ZeroMQ的更多信息,我们可以参考:
If you are able to modify the desktop applications, implementing a websockets connection with SignalR might be worth a look. 如果您能够修改桌面应用程序,那么使用SignalR实现websockets连接可能值得一看。 The desktop applications sign up with a SignalR hub you provide.
桌面应用程序使用您提供的SignalR集线器进行注册。 You can then push data to the clients from, for example an ASP.NET MVC app.
然后,您可以从例如ASP.NET MVC应用程序将数据推送到客户端。 It works very reliable and handles lots of connections well.
它工作非常可靠,并且可以很好地处理许多连接。 It is typically used for realtime web communication but might be useful in your case, too.
它通常用于实时Web通信,但在您的情况下也可能有用。
The downside is probably, that the desktop app needs to initially sign up to a hub to receive push messages. 不利的一面可能是,桌面应用程序最初需要注册到中心才能接收推送消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.