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

We have SharePoint 2013 Servers that were patched with windows updates and since then we are receiving the following error. We have restarted the servers, removed the windows updates manually and then restarted the servers, restored to a copy of windows server before the windows update but the error is persisting. We have also removed the temporary files from Windows directory and nothing is helping.

I have attached a screenshot of the Windows Updates that were applied to our servers overnight

 Loading this assembly would produce a different grant set from other     instances. (Exception from HRESULT: 0x80131401) 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

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

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
System.Linq.Enumerable.Any(IEnumerable`1 source) +0
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromAssemblyCollection(IEnumerable`1 assemblies, Boolean buildingFromCache) +210
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +98
System.Web.Compilation.BuildManager.ExecutePreAppStart() +139
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1005

[HttpException (0x80004005): Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +646
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +779


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET    Version:4.0.30319.36366 

I ran into the same exception when developing on Sitecore, and an iisreset cleared the issue.

Loading this assembly would produce a different grant set , FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401). Click Sign In to add the tip, solution, correction or comment that will help other users. Report inappropriate content using these instructions . Wiki > TechNet Articles > SharePoint Troubleshooting: Loading this assembly would produce a different grant set from other instances.


The solution appears to be:

Create a new registry DWORD value called LoaderOptimization and give it the value 1 within the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework".

Further reading:

http://blog.bugrapostaci.com/2017/02/08/loading-this-assembly-would-produce-a-different-grant-set-from-other-instances-exception-from-hresult-0x80131401/

https://social.technet.microsoft.com/Forums/en-US/5db05238-3c12-4e7e-af95-ca56545f0721/loading-this-assembly-would-produce-a-different-grant-set-from-other-instances?forum=sharepointgeneral

Sharepoint broken. "Loading this assembly would produce a , Loading this assembly would produce a different grant set from other instances. (​Exception from HRESULT: 0x80131401) [Answered]RSS. 3  Fixes a problem in which a System.IO.FileLoadException exception is thrown when you run a .NET Framework 2.0-based application on a computer that is running a 64-bit version of Windows. This problem occurs when the application contains a domain-neutral assembly that calls interop methods.


I was able to solve this issue by going into Bindings -> Edit, then removing "localhost" as the Host Name of the site. Worked after that.

System.IO.FileLoadException: Loading this assembly would , "An exception occurred when trying to issue security token: Loading this assembly would produce a different grant set from other instances". Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) An IIS reset does solve the issue temporary until a few new pages and publishing's later. I found a few posts online relating this issue to Microsoft updates and hotfixes. At which an new update / hotfix resolves the problem.


Try disable "Remote Desktop" if it is enabled (example)

After running the command isreset and changing registry,my problem solved.

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

SharePoint Server 2016 : Loading this assembly would produce a , Loading this assembly would produce a different grant set from other instances. (​Exception from HRESULT: 0x80131401) · sharepoint-enterprise windows-server-​  Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) #475 s-tokutake opened this issue Aug 16, 2019 · 9 comments


"Loading this assembly would produce a different grant set from other instances. (​Exception from HRESULT: 0x80131401) " · restart. I am stabbing in the dark here​  SharePoint: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) SharePoint 2016 RTM and keys are available for downloading in MSDN; SharePoint Server 2016 Beta 2 and Project Server 2016 Beta 2 are available! SharePoint Server 2016 IT Preview is available!


System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)<br /> at​  I had faced a similar issue and where i was getting this exception . Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) I did a IIS RESET and the site is working fine..


Loading this assembly would produce a different grant set from other instances Change assembly load optimization -a-different-grant-set-from-other-instances​-exception-from-hresult-0x80131401/ for a supported solution. Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) [Answered] RSS