Loading this assembly would produce a different grant set from other instances

I was trying to get to the root of an issue for a client’s environment that was mysteriously down (SharePoint 2013, March 2017 CU). IIS was up and running, disk space was fine, SQL was also fine, but the sites were just loading blank pages. I checked the error logs, on both the application servers, as well as the web front ends, and they all had this same error message. "An exception occurred when trying to issue security token: Loading this assembly would produce a different grant set from other instances". This is a new one on me, I’ve not seen this error before. (Surprise, it’s SharePoint!)


After a bit of searching, I found this article on TechNet, which advised in setting the trust level to full for the web.config files, clearing out ASP.NET temporary files, and a few other things. None of these solutions worked. However, in the comments of the same article, someone had noted to setting the following registry setting, adding a DWORD (32-bit) value of 1 under a new key named LoaderOptimization in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. And also doing the same under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework.

Rebooted the servers, although I am sure an IIS reset, and a manual restart of all of the services would have done the trick, but the Farm was down, so a reboot wasn’t an issue to perform.

I found more information on the issue from CA, on this page, under the heading "Defect DE46408 (Formerly 369408) – Application Errors When Instrumenting SharePoint", it states:

"This situation usually happens when the SharePoint site web.config is set to use the legacy CAS model. The legacy CAS model was introduced in .NET version 4, and provokes the error. Refer to for a reference of CAS changes in ASP.NET 4."

I am not exactly sure what prompted this issue, except that there were some recent security updates applied, but this did the trick. I’ll have to dig into this deeper as time permits and see if I can determine the root cause.

%d bloggers like this: