When I try to retrieve the user profile count or to update user profile from web part, the error "Only an administrator may retrieve a count of all users" jumped out. The strange thing is, it works well on my development server, just doesn't work on the test server.
In the event log, there is another exception message:
Object Cache: The super reader account utilized by the cache does not have sufficient permissions to SharePoint databases.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperreaderaccount -propertyvalue account -url webappurl'. It should be configured to be an account that has Read access to the SharePoint databases.
Current default super reader account: NT AUTHORITY\LOCAL SERVICE
I had no clue at all. After hours of struggling, I told myself that the stsadm command "setproperty" wouldn't help.
Another strange thing: we cannot grant the administration rights to user from the place below.
That's really weird. There should be some way to specify administrators for "user profile management". After clicking around for around 30 minutes, the answer came out.
As displayed below, there is a "administrators" ribbon button! I feel I am fooled by SharePoint.
I think, on the development server (my laptop), the code works well because I am a domain administrator. I will never do any test under a domain administrator account any more.