何时使用SignalR以及何时使用WebServices? [英] When to use SignalR and when to use WebServices?

查看:142
本文介绍了何时使用SignalR以及何时使用WebServices?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WebServices的新手,所以我开始通过创建项目来了解它们。我的想法是使用JSON创建基于REST的WCF服务,该服务由Windows应用程序使用。此Windows应用程序将数据发布到服务和服务将它们存储在DB中。现在,我想,我将添加一个WebClient,它实际上可以显示从Windows客户端收到的数据。为了在我的WebClient上显示数据,我创建了一个自托管的Signal R控制台应用程序,它与我的WCF服务进行通信并将数据提供给WebClient。



现在,我意识到我可以从我的WindowsClient直接将数据发送到我的SignalR服务器,我的SignalR服务器可以将它路由到WebClient,而不需要在它们之间使用WCF服务。此外,我甚至可以使用SignalR从我的WebClient向Windows客户端发送消息。如果我不得不使用我的REST WCF服务向客户端发送异步消息,那么我需要从WebhttpBinding(我用于REST)更改为netTCPBinding并使其成为一个更复杂的双工服务....它将不会更长的REST兼容



所以我的问题是当我能够使用SignalR完成所有工作时,为什么以及在哪里需要使用WCF或任何webService?



如果我的理解有任何问题请告诉我...提前致谢。

I Am new to WebServices, so I started to learn about them by creating a project. My idea was to create a REST based WCF service with JSON which is consumed by a Windows Application. This Windows application Post's data to the service and the service stores them in DB. Now, I thought, I will add a WebClient which can actually show the data received from the Windows Clients. To display data on my WebClient, I created a self-hosted Signal R console App, which communicates with my WCF service and gets the data to the WebClient.

Now, I realized that I can send data directly to my SignalR server from my WindowsClient and my SignalR server can route it to WebClient, without needing WCF Service in between. Also, I can even send message from my WebClient to Windows clients using SignalR. If I had to use my REST WCF service to send asynchronous messages to clients, then I need to change from WebhttpBinding (which I used for REST) to netTCPBinding and make it a duplex service which is more complicated....and it will no longer be REST compatible

So my question is when I am able to do everything with SignalR, why and where do I need to use WCF or any webService?

Please let me know if there is anything wrong in my understanding...Thanks in advance.

推荐答案

阅读 - 使用SignalR与WCF将数据推送到客户端? [ ^ ]。另请阅读其他答案。



此外 WCF的结束在地平线上 [ ^ ]
Read - Push data to client using SignalR vs WCF?[^]. Also read other answers.

Also THE END OF WCF IS ON THE HORIZON[^]


这篇关于何时使用SignalR以及何时使用WebServices?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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