OWA Virtual Directory missing in IIS after reinstalling CAS Role
One of my colleague mistakenly deleted OWA virtual directory from IIS. I tried uninstalled and reinstalled CAS server role but it fails with the following error message
Exchange Server component Client Access Role failed. Error: Error: An error occurred while creating the IIS virtual directory IIS://contoso.com/W3SVC/1/ROOT/owa on CAS1.
Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
Solution:
This seems OWA file already exists but the OWA Virtual Directory is not visible in IIS, this means the last uninstallation didn’t remove the virtual directory properly and this caused a bad cache in IIS Metabase causing the reinstallation from creating the OWA virtual directory. If OWA virtual Directory is not visible in IIS doesn’t mean it not exists, please check the IIS 7.0 Metabase
- Find adsutil.vbs script on the CAS server, usually it’s in SystemDriver\Inetpub\AdminScripts
- Then open cmd window, and “cd” to the above path
- Use the command below to check the metabase, see if there’s any remained trace about /OWA virtual directory
Cscript adsutil.vbs enum w3svc/1/root
- Try to uninstall iis and reinstall it back delete ClientAccessRole Key under HKLM\software\microsoft\exchange\v8.1 Go to ADSIEDIT => Exchange Servername object and change the value of msexchcurrentserver to 34
- And start the CAS setup again
- The IIS configuration files are located in ApplicationHost.config. This file is located in %windir%\system32\inetsrv\config. Found the below entry even with no owa vdir in IIS manager, remove the entries below and reinstall the CAS server role
<application path=”/owa/8.1.263.0″ applicationPool=”MSExchangeOWAAppPool”>
<virtualDirectory path=”/” physicalPath=”C:\ProgramFiles\Microsoft\Exchange Server\ClientAccess\owa\8.1.263.0″ />
</application>
- Or if this doesn’t work then try the following steps:
- Remove CAS and Hub roles (if exists)
- Remove IIS from the server
- Restart the server
Notes: If the ApplicationHost.config is still present, it can be deleted - Reinstall IIS, and CAS and Hub roles (if exists)