This is a test server to see if it works. I do not have any SharePoint servers in my site.

I host several websites and would like to add a site search to them. After some reading I found that SP2013 Foundation is the replacement for Search Server 2010, which is what MS recommends since they removed the Index service from Windows.

Following the very few posts available for anonymous search using the rest api, I have configured the server as described -- Web Application (SharePoint - 80) Authentication Providers Default Enable anonymous access ON, Require Use Remote Interfaces permission OFF. Root web site settings Anonymous Access Entire Website. Used AnonymousRESTSearch.ps1 to create the QueryPropertiesTemplate folder and queryparametertemplate.xml file. Verified they have anonymous access.

When doing a query from the SP server I get results. When doing a query from my PC (http://server/_api/search/query?querytext='contact'&QueryTemplatePropertiesUrl='spfile://webroot/queryparametertemplate.xml') I get a HTTP 500 error with the following xml returned:

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code>
<m:message xml:lang="en-US">An unknown error occurred.</m:message>

I have even added some CORS properties to the IIS 8.5 site to see if that would help, but nothing has worked so far. I have no idea where to go from here and appreciate any help I could get.

  • does http://server/_api/search/query?querytext='contact' work correctly? Also you could enable verbose logging on 'Query' category of the 'SharePoint Server Search' to see what's the matter. Also, did you follow this guide: msdn.microsoft.com/en-us/library/office/…
    – Mike
    Commented Jul 11, 2015 at 0:03
  • I still get the HTTP 500 error, but with this xml: <?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="schemas.microsoft.com/ado/2007/08/dataservices/…, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code><m:message xml:lang="en-US">The SafeQueryPropertiesTemplateUrl "The SafeQueryPropertiesTemplateUrl &amp;quot;{0}&amp;quot; is not a valid URL." is not a valid URL.</m:message></m:error>
    – Joe Ferrer
    Commented Jul 13, 2015 at 13:07

1 Answer 1


I found the problem! The queryparametertemplate.xml was encoded with UNICODE-16LE instead of UTF-8. After changing the encoding and replacing the file in the library, anonymous search now works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.