Polling Pattern for Silverlight 4 WCF Ria Services

两盒软妹~` 提交于 2020-01-23 10:57:06

问题


I am creating an application in Silverlight using Ria Services that can take quite a bit of time once the service call is initiated. I've looked for ways to increase the WCF service timeout, but the more I think it through, this is not the right aproach.

What I would rather do is call the DomainContext and return right away, then have the client poll the server to find out when the long running query is complete.

I'm looking for a pattern or example of a good way to implement something like this. One potential issue that keeps coming to mind are that web services should not keep state between service calls, but this is exactly what I would be doing.

Any thoughts?

Thanks,

-Scott


回答1:


Take a look at the WCF Duplex Service. It should solve your problem.




回答2:


Can you make the service call take less time? If not, why not?

Typically when I've seen queries take this long, it either means the SQL running at the end isn't efficient enough, the SQL server has poor indexes, or the client is requesting far more data than they'll actually be able to use in a short period of time.

For example, instead of requesting 500 entities right away and showing a large list/DataGrid/whatever, why not request 10-50 at a time and have a paging UI that only requests the next batch when the user nedes it?




回答3:


Take a look at signalr, it can run side by side with ria and it lets you push messages back to the client from the server.



来源:https://stackoverflow.com/questions/4869346/polling-pattern-for-silverlight-4-wcf-ria-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!