SharePoint: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Want create site? Find Free WordPress Themes and plugins.

Several months ago we started to experience this error on all our SharePoint 2013/2016 farms.

Exception message: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromAssemblyCollection(IEnumerable`1 assemblies, Boolean buildingFromCache)
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)


Also in Event viewer there were the following errors, probably related to the issue:

  • Event ID 1000: Application error: Faulting application name: w3wp.exe, version: 10.0.14393.0, time stamp: 0x57899b8a
  • Event ID 1023: w3wp Description: The process was terminated due to an internal error in the .NET Runtime at IP 00007FFAF85534E2 (00007FFAF8540000) with exit code 80131506.

We changed web.config as it was the only solution that worked for us we could find. Today, I stumbled into the great post of Bugra Postaci which explains the cause of the issue and gives the correct solution. Changing of web.config and other solutions on the Internet sometimes help, but are absolutely wrong.

The root of the issue is that Client-side .NET Application Performance Monitoring (APM) is not supported for SharePoint. In our case it was installed by SCOM Agent.

The solution is to remove Microsoft Monitoring Agent.


If you do need it, Bugra suggests the following workaround:

“NOTE ! Workaround – Installing the SCOM Agent with the NOAPM=1 switch prevents the copy of the .NET APM related DLL’s as a result w3wp.exe process cannot load the problematic components which are available under C:\Program Files\Microsoft Monitoring Agent\Agent\APMDOTNETAgent\*.
1) Uninstall the SCOM Agent manually on the SharePoint Servers.
2) Delete the “C:\Program Files\Microsoft Monitoring Agent” folder on your SharePoint Servers.
3) Copy the SCOM Agent folder from your SCOM Management Server to the SharePoint Servers. The Agent folder can be found under C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\AgentManagement\amd64 on your SCOM Management Servers.
4) Open an elevated cmd window and on your SharePoint Server and install the SCOM Agent manually with the NOAPM=1 switch like in the example below.
Example : msiexec /i momagent.msi NOAPM=1
5) Afterwards please kindly install your Update Rollups. The current installed Update Rollup on your SCOM Management Server is also inside the Agent folder available.
C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\AgentManagement\amd64”

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

Your email address will not be published. Required fields are marked *