I have a local service running on my windows 2012 server machine. It is a azure service fabric cluster with one node, but this shouldn't matter for this problem.
The service runs under the "NETWORK SERVICE: user, and has code that accesses a certificate stored on local machine. The code that finds the certificate using X509Certificate2Collection.Find method.
The exception is:
Exception thrown: 'System.AggregateException' in mscorlib.dll
Additional information: Could not successfully acquire access token using thumbprints: 80CEA40A62FFA0116FCB40B7B5985ADCD3E5AC39
When I execute the same Find function with same parameters locally as admin user, it works.
I have tried explicitly granting the NETWORK SERVICE user read permission on the certificate, but this did not solve it.
I have also tried executing code locally under NETWORK SERVICE user context (not as deployed local service, but local executable code snippet) that gets a certificate, and this works, which is strange.