cannot open central admin

Environment: SharePoint 2013 on windows server 2012r2

All of a sudden yesterday I was not able to open central admin. Browser returned 404. Tried IISreset , reboot server, application pools were fine, all the services seemed fine.

Looked in to the ULS error logs and found an error “An exception occurred when trying to issue security token: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401).”

Posted on MSDN forums and received a suggestion about windows update. It seems .net update caused missing registry keys and the solution was to update the registry as below

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework’, create a new ‘DWORD (32-bit) Value’ named “LoaderOptimization” with a value 1.

‘HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework‘, create a new ‘DWORD (32-bit) Value’ named “LoaderOptimization” with a value 1.

MSDN forum research