I have a document library with ~50,000 documents in it. I have a Client Object Model query which retrieves the ListItems in the document library. This query previously worked when the document library was much smaller, but is now throwing a WebException - (503) Server Unavailable. The status property of the exception contains a System.Net.WebExceptionStatus.ProtocolError.

I'm hoping this is just a timeout or size limit that can be fixed by modifying some configuration somewhere. Does anyone have any advice as to what configuration I might change to fix this?

1 Answer 1


How many items are you returning in your query? It could be that you are hitting the List View threshold for the web application. For SP 2010 and 2013 the List View threshold is 5000. And, you will start getting warnings when there are 3000 items in the list. This is the maximum number of items that can be involved in a database operation.

To get around it, you have a few options:

  • Resource throttling is off for the entire Web Application. The list view thresholds have been set to enormous values as well. Still get the exception. The query must return all 50,000 items.
    – MgSam
    Commented Jul 1, 2013 at 17:24
  • but if you throttle the query, does it work? If so your web service is probably choking on 50,000 items in the full call. Those thresholds are there for a reason. If it were me I would push back on the requirement to return 50,000 items in a web service. Commented Jul 1, 2013 at 17:41
  • You're using the Include() syntax to limit the fields returned, right? That would help limit the amount of data going across the wire. Commented Jul 1, 2013 at 17:43
  • I've tried that, but no success. I may have to resort to fetching the data via the server object model and using a custom web service to return it.
    – MgSam
    Commented Jul 1, 2013 at 18:07
  • 1
    Paging the records worked. This is just what I needed, thanks.
    – MgSam
    Commented Jul 1, 2013 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.