开发者

Response time Issue in WCF REST Service returning a large file

开发者 https://www.devze.com 2023-01-18 16:56 出处:网络
HI, I have created a WCF REST service with response format as JSON. The basic functionality of the service is that when it is called it will return a large file(mostly zip file) from the file system

HI,

I have created a WCF REST service with response format as JSON. The basic functionality of the service is that when it is called it will return a large file(mostly zip file) from the file system to the requester. The time taken for the file to completely downloaded by the user is taking more than 2开发者_如何学运维0 mins for 20MB file.

How to find the issue in the service implementation? Is there any config parameters to be included to accommodate large file downloads using WCF REST Service? Is there tools/methods available to monitor the performance of a WCF REST service?


OMG, I just realized that you said you are using a JSON response format. Arrgh, you really do not want to try and serialize zip file into a JSON format. Change your service operation to return a stream and write the bytes directly to the stream.


As far as monitoring the conversation between client and server i'd recommend using Fiddler for that, also have a look at this link which speaks to transfering large data with Web Services.

I'm not sure if refactoring you're code is on the table, but if it is you might consider going with a MTOM strategy. Here is a link to a WCF implementation. This allows you to send/receive binary data in a chunked manner. This is cool because chunking the data, coupled with an AJAX UI, will allow you to present a progress bar to the user that is uploading it and will help to see what the status is for your own sanity.

0

精彩评论

暂无评论...
验证码 换一张
取 消