Exchange 2016 CU9: Virtual Directory errors (HTTP 500) and ASP.NET Event ID 1310

Adam Farage
4 min readFeb 9, 2022

Issue

After installing a fresh copy of Exchange 2016 CU9 on my lab machine, which was running Server 2016 (patched as of March 22nd 2018) I would get following error when attempting to access OWA, ECP, EWS or any other Exchange 2016 virtual service over the loopback address

Troubleshooting

First thing I would normally do in this situation would be to check the service health to ensure everything was running, which it was…

Then, hoping this would be a quick and easy fix due to a lack of oversight, checked the .NET Framework version installed. Exchange 2016 CU9 will support two versions of .NET framework, being .NET Framework 4.6.2 and 4.7.1. .NET Framework 7.0 is not supported.

To do this I use this awesome script I found a while ago, created Martin Schvartzman called “Get-NetFrameworkVersion.ps1”. Unfortunately as you can see below .NET Framework 4.6.2 was installed, so no dice…

Into the Event Viewer: Application logs to see what errors I get when attempting to navigate to /OWA or /EWS, and you see the following below:

Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 3/31/2018 2:47:47 AM
Event ID: 1310
Task Category: Web Event
Level: Warning
Keywords: Classic
User: N/A
Computer: EX16.exchangelaboratory.com
Description:
Event code: 3008 Event message: A configuration error has occurred. Event time: 3/31/2018 2:47:47 AM Event time (UTC): 3/31/2018 2:47:47 AM Event ID: 29366e65b0e14107a612ad702ef08061 Event sequence: 1 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/2/ROOT/owa-7–131669380656800443 Trust level: Full Application Virtual Path: /owa Application Path: C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\owa\ Machine name: EX16 Process information: Process ID: 8980 Process name: w3wp.exe Account name: NT AUTHORITY\SYSTEM Exception information: Exception type: ConfigurationErrorsException Exception message: Could not load file or assembly ‘AntiXSSLibrary, Version=4.2.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f’ or one of its dependencies. The system cannot find the file specified. (
C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\owa\web.config line 116)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly ‘AntiXSSLibrary, Version=4.2.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f’ or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

Request information: Request URL: https://localhost:444/owa/exhealth.check Request path: /owa/exhealth.check User host address: 127.0.0.1 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\SYSTEM Thread information: Thread ID: 11 Thread account name: NT AUTHORITY\SYSTEM Is impersonating: False Stack trace: at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

You can easily read the Web.Config files through notepad, so opening Notepad then the Web.Config file (C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\owa\web.config) noted above and then traveling to line 116 (where the error is) shows me nada

<add assembly=”Microsoft.Exchange.Security, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

If you go to the bottom of the file, you do see a linked Configuration file though..

<linkedConfiguration href=”file://C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\SharedWebConfig.config” />

If I navigate to that directory, the file is missing…

Here is how to fix this issue in particular.

Fix

Luckily this is something that has been a known issue for a while apparently, as it is discussed in KB3099532. Essentially, one of the post installing steps is to put into place the “SharedWebConfig.config” file into two locations…

  • %ExchangeInstallPath%\ClientAccess\
  • %ExchangeInstallPath%\FrontEnd\HttpProxy\

If the file is missing from either location, then the IIS based virtual directories for both FE Transport and Client Access simply wont work. PowerShell will work since that is not using the same library, but instead WinRM to connect.

To fix this, you would run the following commands as needed (depending on if you are missing it in one location or both):

For …\ClientAccess\SharedWebConfig.config

CD Exchange Installation Path\Bin

DependentAssemblyGenerator.exe -exchangePath “Exchange Installation Path\bin” -exchangePath “Exchange Installation Path\ClientAccess” -configFile “Exchange Installation Path\ClientAccess\SharedWebConfig.config”

For …\FrontEnd\HttpProxy\

DependentAssemblyGenerator.exe -exchangePath “Exchange Installation Path\bin” -exchangePath “Exchange Installation Path\FrontEnd\HttpProxy” -configFile “Exchange Installation Path\FrontEnd\HttpProxy\SharedWebConfig.config”

When it is done running, you should see an output within the shell (or command prompt) as shown below:

Afterwards, run IISRESET and you should be good to go!

--

--

Adam Farage
0 Followers

IT Leader, and Subject Matter Expert around Digital Workplace and Microsoft 365.