在測試中,我使用的數據庫的用戶是一個大jefe。在生產中,他只有執行。ASP.Net Membership.DeleteUser
當我打電話,
Membership.DeleteUser(user)
在測試中,它的工作。 我嘗試在生產相同的,我得到這個:
The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Us__UserI__37703C52". The conflict occurred in database "Testing", table "dbo.aspnet_UsersInRoles", column 'UserId'.
在我seargles(在谷歌搜索),我遇到了這個link 其中傢伙說的話,
Error: The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Me__UserI__15502E78". The conflict occurred in database "YourDBName", table "dbo.aspnet_Membership", column 'UserId'.
Took me a while to find a solution to this across multiple sites and options as the error and possible solutions were rather misleading. Turns out, at least in my case, it was a problem with permissions on the membership database. The user I'm using to connect had access to view the membership details within the database itself, but as part of the aspnet_Users_DeleteUser stored procedure it selects from the sysobjects table. The membership connection user apparently did not have sufficient rights to do that select so the overall delete failed.
The fix for me was to add the user to the aspnet_Membership_FullAccess role for the membership database.
但是,當我做到了,它不起作用。任何人有任何想法如何處理這個?
這沒有任何意義..如果用戶對存儲過程aspnet_Users_DeleteUser具有執行權限,則視圖上的SELECT權限應該沒有關係。就像在任何aspnet表上擁有DELETE權限並不重要。 – Matt 2010-07-07 18:37:57