Unable to perform Discovery search from EAC

Symptom:

Unable to perform Discovery search from EAC getting the below error

"An unknown error occurred on the search server. Please contact your administrator for assistance. The message from the search server is 'Could not locate Client Access Virtual Directory object with InternalUrl stamped for service. Last server checked: E2k13SRV"

 

Cause: Whenever discovery search is performed for the first time using EAC in Exchange 2013, it will check for the following 6 internal URLS in the background and it will cache it locally

Found URL: https://e15-cas.contoso.com/owa

Found URL: https://e15-cas.contoso.com/ecp

Found URL: https://e15-cas.contoso.com/EWS/Exchange.asmx

Found URL: https://e15-cas.contoso.com/Microsoft-Server-ActiveSync

Found URL: https://e15-cas.contoso.com/OAB

Found URL: https://e15-cas.contoso.com/mapi

[GlobalServiceUrls.DiscoverUrlsIfNeeded] Successfully found all needed VDirs

 

Resolution:

We need to make sure all the required virtual directories are present and internal URLs are published on those VDirs. In my case mapi virtual directory was missing and it failed while fetching the internal url of mapi virtual directory on the E15 CAS server.

Once Mapi virtual directory was created with InternalUrl, error went away.