Search code examples
sharepointmosssharepoint-2007

SharePoint "Thread was being aborted" looping through a SPListItemCollection


I have a SPListItemCollection with ~500 items in. I am looping through using a for each loop, each time grabbing the file and writing it out to a pdf document. I am getting the error "Thread was being aborted". It looks to be a time out issue but I dont know how to fix it? Collections with 200-300 items work fine. Is there any way I can stop getting this error. If I cant increase the timeout I will need to batch it up.

Update

I have tried splitting up the processing in batches of 100 items. With each new 100 items using a new spweb and site and pulling the items from sharepoint. This is all done within the same method (so I am not recreating my custom object) however the same error is still occuring...


Solution

  • http://blogs.msdn.com/solutions/archive/2009/01/08/getting-around-thread-was-being-aborted-error-when-creating-ep-site.aspx

    1. In a basic text editor such as Notepad, open the web.config file for example ' %SYSTEMDRIVE%\Inetpub\wwwroot -or- %SYSTEMDRIVE%\\Inetpub\wwwroot\wss\VirtualDirectories\80 folder

    2. Press CTRL + F to open the Find dialog box.

    3. Find the following tag:

      <httpRuntime maxRequestLength="51200" />

    4. Replace it with this tag:

      <httpRuntime executionTimeout="6000" maxRequestLength="51200" />

    This seems to have got it working for me.