In Central Administration > Application Management > Manage web applications I received the following error:

The type initializer for '<Module>' threw an exception


The corresponding ULS logs mention:

System.ArgumentException: Invalid token for impersonation - it cannot be duplicated.   
 at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)    
 at System.Security.Principal.WindowsIdentity..ctor(SerializationInfo info)    
 at System.AppDomain.get_Id()    
 at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)    
 at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr , Void* )    
 at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )    
 at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )


An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  Due to flags specified at object creation, this will not be freed until processed by garbage collection.  Allocation Id: {49A40E83-3277-4578-A831-1276F291846B}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.

In order to fix this error, I performed an IIS reset using command prompt:

  • Open command prompt as administrator;
  • type: iisreset /noforce;
  • retry loading the page.

This fixed the error for me.

  • Thanks a lot. Never see such error. Very Panic. It is fixed so easy.
    – Mark L
    Feb 21 '17 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.