Click here to Skip to main content
15,936,709 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)

I have a sharepoint site that hold a very large list (more than 5000 items).
I was thinking of exposing a web service that eill return a list of guids.
I have a class that returns said list and I am trying to instantiate the class from the web service.
If I try to implment the class that returns the list of guid in an console application, everything works and I get the list of guids.
However, if i try to instantiate the class from a web service, when trying to open the site collection:

using (SPSite site = new SPSite(strSite))

I am getting an error

System.IO.FileNotFoundException: The Web application at http://npebwebstream could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Does anyone have an idea how to overcome this problem?

Here is the code

public void ProcessLargeList()
    ContentIterator iterator = new ContentIterator();

    //Here it works in a console application, and fails once being called from with in a
    //work service.

    using (var oSite = new SPSite(Site))
        using (SPWeb oWeb = strWeb.Length > 0
            ? oSite.OpenWeb(Web)
            : oSite.RootWeb)
            SPList spDoc = oWeb.Lists[DocumentLibrary] as SPDocumentLibrary;

            if (Query != null && Query.Length > 0)
                SPQuery spquery = new SPQuery();
                spquery.Query = Query;
                spquery.QueryThrottleMode = SPQueryThrottleOption.Override;
                Status = IterationStatus.Started;

                //Runs through the content iterator and adds the items to the list of guids.

                iterator.ProcessListItems(spDoc, spquery, ProcessListItem,
                iterator.ProcessListItems(spDoc, ProcessListItem,
            Status = IterationStatus.Completed;

Thanks in advance,


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900