SingalR2 / WCF服务连续运行Windows服务(SingalR2 / WCF Service to run continuously windows service)

编程入门 行业动态 更新时间:2024-10-28 12:23:07
SingalR2 / WCF服务连续运行Windows服务(SingalR2 / WCF Service to run continuously windows service)

请帮我做出关键的设计决定。 它看起来像是广泛的讨论,但这是任何开发人员或设计人员知道我们可以创建SingalR作为Windows服务以及如何创建的基本问题。 没有讨论,清楚记录或提及SingalR是否可用于以下场景。 我希望这个问题不仅可以帮助我,还可以帮助开发人员和设计人员。

在SingnalR中,我们如何创建一个服务,该服务连续运行以从Fix连接获得市场价格,因此当客户端连接时,它会更新价格给该客户端以进行任何更改。 任意数量的客户端都可以连接到此服务。

那么我们如何创建SingalR作为持续运行的Windows服务,无缝地并行更新客户端

UI将在WPF,ASP.Net MVC for web,HTML5 Mobile中

对于这个,SingnalR2是最好的,或者WCF是最好的选择

谢谢,ineffablep

Please help me to take critical design decision. It looks like wide discussion but this is the basic question for any developer or designer to know can we create SingalR as windows service and how. There is no where discussed , clearly documented or mentioned whether SingalR can be used in below scenario. I hope this question will help not only me but also loads of developers and designers.

In SingnalR , how can we create a service , which runs continuously to get Market prices from Fix connection, so when ever a client connect it updates prices to that client for any changes. any number of clients can connect to this service.

So how can we create SingalR as a windows service running continuously , updates to clients seamlessly parallel

UI will be in WPF , ASP.Net MVC for web , HTML5 Mobile

For this does SingnalR2 is the best one or WCF is the best option

Thanks, ineffablep

最满意答案

为此,您可以使用Hubs和signalR作为Windows服务http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server

在OnConnected()事件中,当客户端登录到您的singnalR服务器时发生这种情况,通知已经连接的所有客户端更改股票价格

public override Task OnConnected() { // Get stock price // Update client on new stocks Clients.All.UpdateStocks(); }

您的客户需要实施UpdateStocks(),请参阅此处如何创建您的客户端http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-net-client

For this you can use Hubs and signalR as windows service http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server

In the OnConnected() event, that happens when a client is logged in to you singnalR server, notify all client already connected on the change of stock price

public override Task OnConnected() { // Get stock price // Update client on new stocks Clients.All.UpdateStocks(); }

And your clients need to implement UpdateStocks(), see here how to create your client http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-net-client

更多推荐

本文发布于:2023-08-01 16:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1362061.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Windows   Service   WCF   windows   service

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!