PSInvalidOperationException in ASP Web

Error can happen if using impersonate=true in web.config and the ApplicationPool Identity is not the same as the impersonated logon.