One of our customers was having trouble with autodiscovery not functioning on one of their Exchange 2010 CAS-servers. I was asked to take a look at it and one of the errors in the eventlog stood out in particular:
Could not load file or assembly ‘Microsoft.Exchange.Security, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. (C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Autodiscover\web.config line 940)
Now, let’s open the web.config file mentioned in the error message. You will most likely see a whole bunch of file:///%ExchangeInstallDir%, and this is exactly what the problem is. In some cases, Exchange is unable to find the installation path using this variable and luckily the fix for this is quite easy.
Fire up your favourite text editor, and do a Find&Replace on file:///%ExchangeInstallDir%bin and replace it with file:///C:\Program Files\Microsoft\Exchange Server\V14\bin\ or whatever your installation directory is.