Summary/Symptom
Users will browse an extended zone URL
Default Zone = http://v7.contoso.com
Intranet Zone = https://v7intranet.contoso.com
They will insert a search term in the search box and after hitting enter, they will get a “Sorry, something went wrong“, along with a correlation ID
The query should work fine from the Default Zone
If you look at the ULS logs, on the Web Fron Ends, you will see the following callstack:
12/10/2021 15:07:36.84 w3wp.exe (serverwfe1:0x2190) 0x1160 SharePoint Foundation CSOM ahjq1 High Exception occured in scope Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueries. Exception=System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.Server.Search.Administration.UrlMapper.ExtractMapping (Tuple3 key, SPSite site, IDictionary
2 urlMapping, IDictionary2 reverseUrlMapping) at Microsoft.Office.Server.Search.Administration.UrlMapper.GetNewCacheEntry(Tuple
3 key) at Microsoft.Office.Server.Search.Administration.UrlMapper.GetUrlMapping(QueryProperties properties, Boolean useCache, UrlZoneOverride urlZoneOverride) at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.UpdateQueryProperties(SsaOperationFlags operationFlags, QueryProperties properties, VariantConfigurationSnapshot snapshot, SPContext context) at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.Execute(QueryProperties properties) at Microsoft.Office.Server.Search.Query.Query.ExecuteQuery() at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueryInternal(Query query) at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQuery(Query query) at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueries(Dictionary2 queries, Boolean handleExceptions) at Microsoft.Office.Server.Search.Query.SearchExecutor.RunWithRemoteAPIsPermission[T](Func
1 f) at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueries_Client(String[] queryIds, Query[] queries, Boolean handleExceptions) at Microsoft.SharePoint.Client.ServerStub.InvokeMethodWithMonitoredScope(Object target, String methodName, XmlNodeList args, ProxyContext proxyContext, Boolean& isVoid) c802fd9f-e6d4-f013-00e1-6f57ced82828
Cause
- This is usually caused when there is a stale entry in the SiteMap table of the Config DB or a missing “site” within a Content Database
- The Web App’s w3wp will build URLMappings by getting the SiteMap entries and comparing to SPSites…
- If there is an entry in the SiteMap table, but not in the DBs, or vise versa, then this can cause this issue.
- It does not happen within the Default Zone Url because it does not need to do UrlMapping, based on Zones and AAMs
- The failure does not have to be within the same Web App\Content DB as you are trying to browse.
- It could be in any other Web App\Content DB, since the w3wp will enumerate all sites and build mappings.
- If you filter on the thread, within ULS, you should see something similar to this, right before the Exception is thrown
12/10/2021 15:07:09.88 w3wp.exe (serversfe:0x2548) 0x0454 SharePoint Foundation General 6t8g Verbose Looking up typical site https://mysite.contoso.com:443/my/tree-stablished in web application SPWebApplication Name=MySites.
12/10/2021 15:07:09.88 w3wp.exe (serverwfe:0x2548) 0x0454 SharePoint Foundation Site Cache az4z7 High Looking up /my/tree-stablished in database .
Resolution
You can run the following to run through ALL content DBs in the Farm and update the SiteMap table
$contentDBs = Get-SPContentDatabase
foreach($db in $contentDBs)
{
"Refreshing siteMap table for database: " + $db.Name
$db.RefreshSitesInConfigurationDatabase()
}
This should get a list of SPSites from each DB and remove\re-add them into the SiteMap table in the Configuration DB
If you identify, in the ULS logs, the Web App and site and choose not to do ALL DBs, then you can run something like:
$webApp = Get-SPWebApplication "https://mysite.contoso.com"
$contentDBs = $webApp.ContentDatabases
foreach($db in $contentDBs)
{
$db.RefreshSitesInConfigurationDatabase()
}
Hope this helps!