SharePoint 2010中关于An error was encountered while retrieving the user profile的处理方式记录

今天,在我将用户权限提升为system account之后,打算使用SocialTagManager.GetAllUrls(Term term)获取所有标记为指定的term的url。但是在调用的时候就报下面的错误:

An exception has occurred. ExceptionType: 'UserNotFoundException' ExceptionMessage: 'An error was encountered while retrieving the user profile.' StackTrace: ' at Microsoft.Office.Server.UserProfiles.UserProfileCache.GetUserData(UserProfileManager objManager, Nullable`1 recordId, Guid gAcct, String strAcct, Byte[] bSid, String strEmail, Boolean doNotResolveToMasterAccount) at Microsoft.Office.Server.UserProfiles.UserProfileCache.GetUserProfileByAccount(UserProfileManager objManager, String accountName) at Microsoft.Office.Server.UserProfiles.UserProfileManager.GetUserProfileRecordId() at Microsoft.Office.Server.UserProfiles.ProfileLoader.EnsureUserProfileRecordId() at Microsoft.Office.Server.SocialData.SocialDataManager.GetCurr... 90ee5734-6bb5-4ee3-a216-4736239fce66
08/15/2011 16:33:05.65* w3wp.exe (0x18A4) 0x0F8C Patterns and Practices SharePoint Guidance 0000 Information ...entUserProfileRecordId() at Microsoft.Office.Server.SocialData.SocialTagManager.GetAllUrlsTaggedWith(Guid termID, Nullable`1 from, SocialItemPrivacy socialItemPrivacy) at Microsoft.Office.Server.SocialData.SocialTagManager.GetAllUrlsTaggedWith(Guid termID, Nullable`1 from) at Microsoft.Office.Server.SocialData.SocialTagManager.GetAllUrls(Term term) at HP.ITSE.APAD.SharePoint.GCN.WebParts.SocialTaggedUrlListsWebPart.SocialTaggedUrlListsWebPartUserControl.<>c__DisplayClass1.<Render>b__0()' Source: 'Microsoft.Office.Server.UserProfiles' TargetSite: 'Microsoft.Office.Server.UserProfiles.Cache.UserData GetUserData(Microsoft.Office.Server.UserProfiles.UserProfileManager, System.Nullable`1[System.Int64], System.Guid, System.String, Byte[], System.String, Boolean)

错误的大致意思就是找不到user profile。

   发生这个错误的原因是我将权限提升为了system account,所以代码在process 的user profile也使用system account 的user profile,但是在user profile中找不到system account 的user profile. 然后我按以下步骤将问题解决:

    1. 打开Central Administrator-->Security-->General Security,拷贝Configure  service accounts中的用户名.    

    2. 点击Central Administrator-->Application Management ,打开Service Application下的Manage Service Applications.

    3.在step2中打开的页面中点击User Profile Service.然后选择People中的Manage User Profile.

    4.在页面中查询step1拷贝的用户名的user profile, 出现上述就是因为在这里找不到profile .

    5.点击New Profile,为step1拷贝的用户添加一个新的user profile.

    6.错误解决!

原文地址:https://www.cnblogs.com/snailJuan/p/2140596.html