简体   繁体   中英

How to handle large data in wcf service?

Web application calls a wcf method to get data from DB, but it's very big data. It takes time, during this time whole application hangs for that particular user, user is not able to do anything in web application. Anybody knows how to handle this case? Is this related to wcf throttling, instance mode or threading?And please let me know how to handle such cases when we need to select very big data from DB and need to bind it to some gridview In case of very big data, it takes long time and time expiration exception occurs. Is there any good article or link which describes how to handle these scenarios in WCF service.

You've asked quite a few questions, its better to ask one specific question.

Application Hangs

If the application is Windows Forms, then access the Web Service using a BackgroundWorker or one of the new async methods in webClient . By using a different thread the UI will not hang.

If the application is javascript, then use Ajax for the same purpose.

Select Big Data

Convert you Web Service to a chatty interface. Instead of requesting 1M rows of data, ask for only a page at a time. You could also employ infinite scrolling that pre-fetches the next page in the background.

WCF instance mode

This affects speeds only when simultaneous requests are being made to the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM