SharePoint Foundation Event ID 8306
I was testing my SharePoint 2013 disaster recovery farm today and was getting a HTTP 500 Internal Server Error for each of the site collections. I could see that Event ID 8306 was being recorded in the Application event log:
An exception occurred when trying to issue security token: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs..
I didn’t want to restart the WFE servers so had a little play around and in the end I was able to fix this by restarting the SecurityTokenServiceApplicationPool application pool in IIS.