Friday, November 8, 2013

SharePoint 2013 Search: Crawl Issue - SPServiceContextScope is Being Disposed Out of Order

We were experiencing "blank" search results from certain result types related to business data connectivity service content sources. When attempting to run full crawls, there would be periods of crawl issues in the crawl log:

Error while crawling LOB contents. ( Error caused by exception: System.InvalidOperationException This SPServiceContextScope is being disposed out of order.; SearchID = <<guid>> )

I figured this was causing the empty results to appear and there seemed to be no way of fixing this. I didn't want to reset all content as we have many content sources and I would spend all day trying to crawl each one. So therefore I decided to try a less disruptive approach and it worked!

Here's what I did:

  1. Deleted the Content Source from the Search Service Application
  2. Recreated the Content Source using the same name.
  3. Run a full crawl on the content source
  4. Once the full crawl is finished, repeat for any other BCS content sources.
This was very easy and it fixed all of my blank results. In addition, this process did not bring down search or remove any content. This was a great fix-in-place solution!

On completion of my full crawls, I now had no Warnings or Errors on the two content sources I recreated:



  1. Hi,
    The time between you deleted the content source and the new full crawl had completed would serve no results right? As a deleting a content source will start removal of indexed items for that source.

    Mikael Svenson

    1. I did it quick enough that results still appeared. Maybe some were cached. I was expecting no results and maybe some queries would have shown nothing. I was doing a '*' and did notice less total results but then an increasing number as the full crawl progressed. So the overall perception at least was that search was still up and running.

    2. Cool, and guess there were not millions of items either for the source :) And still much better than an overall downtime.

    3. Yep. A little under 80k items as shown in my screenshot. All good.


Matched Content