Reputation: 9332
I Have an ASP.NET MVC3 solution with a WCF service. When I get a list of companies (more than 2200 records) from this WCF service, I got the error: The maximum message size quota for incoming messages has been exceeded.
The reason is in the Web.Config file: the maxBufferPoolSize and maxReceivedMessageSize was 65536. I changed to 900000 and now I don't have any problems.
My question: is it still reasonable to have a value of 900000 (900k) for maxBufferPoolSize and maxReceivedMessageSize? I really need all my records to paginate data.
Sub question: is it more efficient to 'paginate' directly in the WCF service and return only the needed page of data? Is it worth?
Thanks for your help.
Upvotes: 0
Views: 382
Reputation: 8880
MaxReceivedMessageSize should be kept small to avoid DoS attacks. If your service is in an intranet scenario, it should be OK to be larger than the default. If it's on the public intranet, you need to weigh up the impact of an attack vs. the usability impact of requiring paging.
The maxbufferPool size is more difficult to answer because it depends on how many concurrent request you expect. Try this for an explanation
http://social.msdn.microsoft.com/Forums/en/wcf/thread/d6e234d3-942f-4e9d-8470-32618d3f3212/
Upvotes: 1
Reputation: 1878
900k message size is not unreasonable. I would suggest running some checks to make sure it gives you room for expansion eg. will it still fit when you have 4000 records? I've seen other suggestions of 2MB as a limit, so you are well within that.
An alternative, based on your comments, would be to provide two methods:
GetAllRecords()
returns all
GetSomeRecords(int limit)
returns a subset, plus a count of the total available.
Your client app can choose which method to call, based on user preferences. If the user wants to see pages, call GetAllRecords and paginate within the client app.
Upvotes: 1