从数据库向客户端网站发布实时数据的最佳方法是什么? [英] What is the best way to publish real time data to the client website from database?

查看:84
本文介绍了从数据库向客户端网站发布实时数据的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我很难从SQL Server 2008实时将数据推送到客户端网站!

也许如果有人有这方面的经验,可以给我一些提示更好的方法,如果有一个例子,将不胜感激!

我尝试了一些方法,比如signalR!但我不是那么专家!

所以我拥有的是数据库中的表(SQL server 2008)和ASP.NET Web应用程序

我需要实时向WEBForm发布数据

例如,如果数据库获得新记录,则显示在webform strat away中Ò



非常感谢你!

I have difficulty to pushing data in realtime to the client web from SQL server 2008!
perhaps if someone have experiance with this and can give me some tips what way is better and if there is an example of that will be appreciated!
I tried sveral way such as signalR! but I am not so expert in that!
so what I have is a table in database (SQL server 2008) and ASP.NET Web Application
I need to publish data in realtime to WEBForm in realtime
for example if the database get new record it Shows in the webform strat awayز

thanks you so much!

推荐答案

网站不是实时的。您可以做的最好的事情是定时器上的AJAX调用并定期刷新数据。无论数据是否发生变化,您进行该调用的频率越高,您的数据库工作量就越多。
Websites are not realtime. The best you can do, is an AJAX call on a timer and refresh data regularly. The more often you make that call, the more work your DB has to do, regardless of if the data changes.


您可以通过SQL依赖关系和信号R实现此目标。将记录输入到表中,依赖项将触发您可以捕获的事件,然后转发到Signal R中心。



继续使用Signal R,它可能是我曾经用过的最简单的事情来快速启动和运行!



查看文档(如果你遵循这个,你将能够运行一些东西)

https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs [ ^ ]



..来自Scott的文章

http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR。 aspx [ ^ ]





如果您控制所有代码(例如将数据放入SQL表的代码),那么你可以拦截这一点,只是向你的Hub发送一条消息,你就不需要SQL依赖。
You could achieve this with an SQL Dependency and Signal R. Whenever a new record is entered into the table, the dependency would trigger an event that you could catch and then forward on to your Signal R hub.

Have a go of Signal R, it's possibly the simpliest thing I've ever worked with to get up and running quickly!

Have a look at the documentation (you'll be able to get something running if you follow this)
https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs[^]

...and an article from Scott
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx[^]


If you control all of the code (e.g. the code that is putting data into your SQL table) then you can intercept at this point and just send a message to your Hub and you wouldn't need an SQL Dependency.


我解决了问题现在正在使用signalR,感谢所有的你们!

问题是我没有以正确的方式引用脚本库。





谢谢对于所有人,我想有一个例子,我怎么能用ajax只使用计时器,因为我不知道有多少客户端和数据有效的signalR!如果有人有关于那个PLZ的更多信息给我发送链接!

/ Mo
I solve the problem It is working now with signalR, thanks for all of you guys!
the problem was I didn't refer to the script library in the right way.


Thanks for all, and I would like to have example how I can do that with ajax only using timer, since I am not sure how much efficient signalR with lot's of clients and data! if anyone have more information about that plz send me a link!
/Mo


这篇关于从数据库向客户端网站发布实时数据的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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