Consider the following scenario.
You configure outbound Hybrid Search to return results from SharePoint Online in a SharePoint 2013 on-premises environment.
When a user performs a query from a SharePoint 2013 on-premises site, only results from the SharePoint 2013 on-premises environment are displayed. No results are returned from SharePoint Online.
An administrator edits the query rule that's associated with the result sources. Then, the administrator opens Query Builder from the result block. However, this triggers the following error:
1 3/4 System.Net.WebException: The request was aborted: The request was canceled. -->Microsoft.SharePoint.IdentityModel.OAuth2.SPOAuth2ErrorResponseException: The remote server returned an error: (404) Not Found. at Microsoft.SharePoint.IdentityModel.OAuth2.SPOAuth2Client.GetResponse(Uri stsurl, OAuth2AccessTokenRequest message) at Microsoft.SharePoint.IdentityModel.OAuth2.SPOAuth2Client.RequestOAuthToken(Uri stsUrl. OAuth2AccessTokenRequest request) at stslnfo, OAuth2EndpointIdentity endpointldentity) at Microsoft.SharePoint.IdentityModel.OAuth2.SPOAuth2SecurityTokenManager.GetRawBearerToken(String nameldentifier, SPSecurityTokenServiceConnectionInformation stslnfo.
Additionally, the following exception is logged in the Unified Logging Service (ULS) log:
An exception occurred during OAuth2 request to <url specific to your site> The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.IdentityModel.OAuth2.SPOAuth2Client.GetResponse(Uri stsUrl, OAuth2AccessTokenRequest message)
To resolve this issue, determine whether the Search Service Application Proxy was deployed in partition mode. If it was, remove and then re-create the proxy without using partition mode.
Office 365 doesn't support incoming Hybrid Search queries when the on-premises Search Service Application Proxy is deployed in partitioned mode.
Follow best operational practices and perform a backup before you follow these steps. For more information, go to Back up Search service applications in SharePoint Server.
To do this, follow these steps in the SharePoint Management Shell.
Obtain the ID of Search Service Application. To do this, run the following cmdlet:
Obtain the ID of Search Service Application Proxy. To do this, run the following cmdlet:
$ssaproxy=Get-SPServiceApplicationProxy –identity <guid>
NOTE: The service application proxy GUID is unique to every farm. Run the Get-SPServiceApplicationProxy cmdlet, and note the GUID of the search service applications proxy.
Review the $ssaproxy.properties results. The proxy should be listed as partitioned. If this is the case, go to step 4 to update the Proxy Properties.
Update the Proxy Properties. To do this, run the following cmdlet:
$proxy = get-spenterprisesearchserviceapplicationproxy
$proxy.Properties[“Microsoft.Office.Server.Utilities.SPPartitionOptions”] = 0
$ssa = get-spenterprisesearchserviceapplication
After you complete these steps, check whether the issue is resolved. Otherwise, go to step 5 to remove and re-create the proxy.
Remove Search Service Application Proxy. To do this, run the following cmdlet:
Create a new Search Service Application Proxy. To do this, run the following cmdlet:
New-SPEnterpriseSearchServiceApplicationProxy -SearchApplication $ssa -Name "Search Service Application Proxy"
After you follow these steps, the SharePoint 2013 on-premises search farm should start returning results from SharePoint Online.
For more information, go to Understanding multi-tenancy in SharePoint Server 2013.
Still need help? Go to Microsoft Community.