Hi,
I have a web service that may return a very large amount of data. I want
that data to return in chunks, like first return 10% of data than return the
next 10% and so on, until all is finished. How are other people doing this?
I have come up with the following way:
While inside the webmethod, fetch the data from the db and store it in a
file called "someguid.data" and return the guid. The client will receive a
guid and request again, by calling another method, this time requesting 10%
of this guid. The ws on receiving this guid and the n% requested, willl open
the file and return the n% and close the file again. This way client will go
on requesting until 100% data has been received and the file will be
deleted. I know I'll have to make sure that the file does get deleted at all
costs in diffierent scenerios, but that is another issue to be tackled
later. For now I want this primary task of returning large amount to data to
be completed.
Am I thinking ok ?
Regards,
K.
Josh Twist - 03 Apr 2006 08:34 GMT
Hi Kamran,
Can I ask why you want to deliver the data in chunks rather than in one
go?
Remember, usually, the less negotiation (opening connections, making a
request to IIS etc) that has to go on, the better?
Josh
http://www.thejoyofcode.com/
kamran - 04 Apr 2006 16:36 GMT
Hi,
thanks for the reply, I'm trying to do this because it takes a lot of time
to get that amount of data and I want the client to be able to cancel it
after receiving some portion of the data if he chooses to do so.
I must get the solution for this.
regards,
Ab.
> Hi Kamran,
>
[quoted text clipped - 6 lines]
> Josh
> http://www.thejoyofcode.com/
Josh Twist - 04 Apr 2006 17:21 GMT
Hi Kamran,
I replied to a similar post a while back where the OP needed to write a
cancellable Web Service. Maybe this can work for you also? Please bear
in mind that this is a very simplified example.
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webservi
ces/browse_thread/thread/3048c99e62626d13/79dffb199ec04236?lnk=st&q=&rnum=32#79d
ffb199ec04236
Josh
http://www.thejoyofcode.com/