Trong thử nghiệm, người dùng trên một db tôi đã sử dụng là một jefe lớn. Trong sản xuất, anh ta chỉ có Execute.ASP.Net Membership.DeleteUser
Khi tôi gọi,
Membership.DeleteUser(user)
Trong thử nghiệm, nó làm việc. tôi cố gắng như nhau trong sản xuất, và tôi có được điều này:
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'.
Trong seargles của tôi (tìm kiếm trên Google), tôi tình cờ gặp link này nơi anh chàng đang nói,
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.
Nhưng khi Tôi đã làm điều đó không hiệu quả. Bất cứ ai có bất kỳ ý tưởng về làm thế nào để đối phó với điều này?
Điều này không có ý nghĩa .. Nếu người dùng có quyền thực thi trên thủ tục được lưu trữ aspnet_Users_DeleteUser, quyền SELECT trên chế độ xem không quan trọng. Cũng giống như có quyền DELETE trên bất kỳ bảng aspnet nào không quan trọng. – Matt