I was recently working with one of my customer and he had issues while performing discovery search.
He was typically getting a 404 error while performing search.
Customer was trying to perform a query and export data to a .pst.
Error as given below:
Digging more into it and found customer was using a custom IIS site.
Custom IIS site was missing EWS virtual directory.
Note: EWS needs a unique IP address assigned and loop back IP must be remove. Don’t remove loop back IP from backend and default site.
New-WebServicesVirtualDirectory -WebSiteName CustomSitename
Disclaimer: Please make sure we are not making any changes in the default and backend site.
Apply to Exchange 2013.