The error occurs recently when one of our client migrated their VMs.

Users were unable to open SharePoint Sites. After support ticket, when we checked the SharePoint Server and browse the SharePoint sites or Central Administrator, page was blank/404 error.

At first, I reset IIS and restart the server. However, no luck :(.

Secondly, I checked services, databases and server and found all are in normal state.

Then, I re-run the SharePoint Product configuration wizard and change webconfig file with Custom error to off.

Custom Error Off: Go to folder location of Central Administrator (from IIS) >> Open webConfig file >> Change customErrors mode on.

<system.web>
    <httpHandlers />
    <customErrors mode="Off" />

Right after this, when we open the SharePoint central administrator then got the actual error.

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.Count(IEnumerable`1 source)   +0
     Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandler.ReadCore(String   name, HttpContext context) +366
     Microsoft.IdentityModel.Web.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken&   sessionToken) +93
     Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(Object   sender, EventArgs eventArgs) +61
     Microsoft.SharePoint.IdentityModel.SPSessionAuthenticationModule.OnAuthenticateRequest(Object   sender, EventArgs eventArgs) +231
     System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   +176
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&   completedSynchronously) +169

This error gave clue for solution. We did some google search and found the solution.

Resolution: Do register entry in App server.

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

Another workaround solution:

From:
<trust level="Full" originUrl="" legacyCasModel="true" />
To:
<trust level="Full" originUrl="" legacyCasModel="false" />

Kind Regards!