Exchange 2013 Unable to access ECP Encounter “500 Unexpected Error”

Today we faced an issue in accessing ECP through an admin delegated account and got the below error. we thought of writing up a blog with few general checklists that can be performed if you come across this kind of issue.

https://exchangequery.files.wordpress.com/2015/05/ecp.png?w=600&h=451

Below are the troubleshooting steps that can be performed in this order if you come across issues with accessing the ECP virtual directory.

1) Check if there is any issue with the XAML file type.

Find the file located in:

C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\ecp\DDI\RemoteDomains.XAML

https://exchangequery.files.wordpress.com/2015/05/xaml.png?w=600&h=306

If you have any staging servers with the same version where it is working, just copy this XML file or if you could find this file from the setup just replace with the existing one. Do an IIS Reset and see the results.

 

2) Check on the Application Pools to view whether OWA and ECP Application Pool is running on .NET Framework v4.0. It may be an incomplete or corrupted installation of Framework that causes this error.

https://exchangequery.files.wordpress.com/2015/05/app.png?w=600&h=317

You might come across the above if you recently made any recent upgrade or it's a fresh installation.

If that’s the case try to run the following command as Administrator:

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Change the MSExchangeECPAppPool from .NET Framework from v4.0 to v2.0. Then restart IIS and check the results.

https://exchangequery.files.wordpress.com/2015/05/xaml2.png?w=600

3) Check the bindings of the default website to confirm to Microsoft recommended settings**:**

({http port 80 *}{http port 80 127.0.0.1}
{https port 443 *}{https port 443 127.0.0.1})

 

https://exchangequery.files.wordpress.com/2015/05/xaml3.png?w=600&h=355

4) If none of the above steps works try recreating the ecpvirtualdirectory and see the results.

In EMS, please run the following command:

Remove-Ecpvirtualdirectory –Identity “CAS\Autodiscover (xxxxx)”

New-Ecpvirtualdirectory –Identity “CAS\Autodiscover (xxxxx)”

There are more cases where even recreating the ECP virtual directory or any virtual directory will still cause this same error 500 unexpected error.

This is because of the stale entries present in the ECP objects as well as in the IIS metabase.

If recreating corresponding affected VD doesn’t help you then try the below steps.

Remove the newly created ECP virtual directory:

Remove-Ecpvirtualdirectory –Identity “CAS\Autodiscover (xxxxx)”

5)  Remove the ECP objects in AD container**.**
**
**a. Open ADSIEDIT.msc, locate:

Configuration–>CN=Services–>CN=Microsoft Exchange–>CN=Organization–>CN=Administrative Groups–>CN=Exchange Administrative Groups–>CN=Servers–>CN=Exchange–>CN=Protocols–>CN=HTTP

b. In the right pane, please check whether the CN=ECP(xxx) is present. If it's present you can remove it.

https://exchangequery.files.wordpress.com/2015/05/xaml4.png?w=600&h=248

6. Delete the AutoDiscover in metabase.

a. Download the IIS 6.0 Resource Kit Tools from the following link:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&displaylang=en

b. Install it on the CAS server. Open the “Metabase Explorer” (Open it in elevated mode).

c. Locate: Exchange -> LM -> W3SVC -> 1 -> ROOT.

https://exchangequery.files.wordpress.com/2015/05/xaml5.png?w=600&h=289
d. Check if you are able to find ECP virtual directory is present. If so, remove it.

7. After that, try recreating the ECP virtual directory and see the results:

New-Ecpvirtualdirectory –Identity “CAS\Autodiscover (xxxxx)”

Most likely after following the above troubleshooting steps the affected ECP VD should start working. You can also follow the same troubleshooting steps if in case you are getting the same error in accessing the OWA, EAC, Autodiscover and PowerShell Virtual Directories.

Hope this article is helpful.