SharePoint 2013 Search not working for anonymous users

We had a public site that has a lot of Content Search web parts, everything was working fine but suddenly search web parts stopped working only for anonymous users and was working fine for logged in users.

After some Googling and full crawling, I managed to get it working using the following PowerShell Script, I had run it for every list and library that search read data from

 

#Add-PSSnapin microsoft.sharepoint.powershell
cls
 $web = get-spweb "http://your server"
 $web
$list = $web.Lists["List Title"]
$list
$list.BreakRoleInheritance($true)

$list.AnonymousPermMask = $list.AnonymousPermMask -bor ([int][Microsoft.SharePoint.SPBasePermissions]::ViewFormPages) #binary or adding the permissions

$list.Update()

 

 

Advertisement

SharePoint 2013 Search not working because of Configuration cache

Today, I had an issue with SharePoint Content Search Web Parts, it kept showing a message about something wrong happened, I logged into the application server that has the search component running and checked the content sources and found that the crawler is stuck for over 200 hours.

I tried restarting the search controller and it failed to start due to log in failure, well, the password for the service account was changed 😦

I set the new password and started the services, ran the crawler and still the web parts showing errors and no results are showing.

I opened Google Chrome PostMan and  tried issuing a REST request to the search API and I got an XML response with the following exception

-1, Microsoft.Office.Server.Search.REST.SearchServiceException

Next thing was to have a look at the event viewer and this is from where i started, i found the following error:

An update conflict has occurred, and you must re-try this action. The object SearchRuntimeService 

It seems that for some reason, the SharePoint Configuration Cache became inconsistent across all servers, so I followed the steps in the below link and from 2 App servers and 4 WFE, only 1 App server didn’t work and the value inside the cache.ini file didn’t change and the number of XML files were fewer than the rest of servers.

After a lot of search, I had no other option but to rerun the configuration wizard on this App server, and guess what? The Config Wizard stopped after the second step.

After going through the log file, I found that there was a missing DLL related to one of our custom developed timer jobs, Once I installed this DLL, the config wizard completed successfully, the cache.ini file has the updated file and finally I got SharePoint search working as expected.

S0, What is SharePoint Configuration Cache?

It is a setup of XML + INI files stored at C:\ProgramData\Microsoft\SharePoint\Config\<GUID>, on all SharePoint farm servers, it contains a copy of objects stored in the Farm Configuration database, If for any reason the configuration files became inconsistent, you will have stop the timer service, clear this folder except for the cache.ini file, set the value of the cache.ini file to 1 and start the timer service again, this will ensure that all files are updated with the latest configuration for the farm.