Community server Username issue - User Username not found in membership store does not exist

与世无争的帅哥 提交于 2019-12-11 08:48:03

问题


I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx is traversed on a specific sectionID. I suspect that a username has been amended but the posts havn't recached to reflect this.

Is there a way a can check the data integruity by performing a select statement on the database, alternatively is there a way to force the database to recache?


回答1:


This error could be thrown by community server if it finds users that aren't in the instance of MemberRoleProfileProvider.

See CommunityServer.Users AddMembershipDataToUser() as an example

UPDATE:


I Solved this problem for my case by noticing that the usernames are stored in two tables - cs_Users and aspnet_Users. Turns out somehow the username was DIFFERENT in each table. Manually updating so the names were the same fixed this problem.

Also, the user would left out of membership in the following line of the stored procedure cs_Membership_GetUsersByName:

INSERT INTO @tbUsers
  SELECT UserId
  FROM   dbo.aspnet_Users ar, @tbNames t
  WHERE  LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = @ApplicationId

The @tbNames is a table of names comes from cs_Users(?) at some point and therefore the usernames didn't match and user was not inserted in to the result later on.


See also: http://dev.communityserver.com/forums/t/490899.aspx?PageIndex=2




回答2:


Not so much an answer, but you can find the affected data entries by running the following query...

Select * 
FROM cs_Posts
Where UserID Not In (Select UserID 
                     From cs_Users Where UserAccountStatus = 2)


来源:https://stackoverflow.com/questions/156688/community-server-username-issue-user-username-not-found-in-membership-store-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!