简体   繁体   中英

How to optimize WCF service for ajax calls?

I have a wcf REST application hosted on IIS. Everything works fine, GET and POST. I'm calling through jquery ajax.

My client app seems not very responsive, I checked on the browser console log of what makes it very slow, found out that my WCF request are eating much of the time. I have like 4 requests, each of them are no less than 350ms plush other js and css files. JS and CSS files were already minified. Now my problem is how can I reduce the time spent on my WCF calls? I can't do async by the way because each response from the service is needed by the other request.

Should you have any suggestions please let me know.

If you can't do async because your requests are dependent you may try to reduce the number of requests you are sending: so instead of having 4 separate small requests do one larger request.

Another possibility is to perform the next request once the first succeeds inside the success callback and so on for the others. This way you are doing async and not freezing the client browser during those requests. But is is usually better to do a single request.

Now my problem is how can I reduce the time spent on my WCF calls?

This will obviously depend on what your WCF service is doing.

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