Beim Testen war der Benutzer auf einer db, die ich verwendet habe, ein großer Jefe. In der Produktion hat er nur Execute.ASP.Net Mitgliedschaft.DeleteUser
Als ich, genannt
Membership.DeleteUser(user)
Im Test funktionierte es. Ich versuche, das gleiche in der Produktion, und ich bekomme diese:
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'.
In meinem seargles (Suche auf Google), stieß ich auf diese link wo der Kerl sagen war,
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.
Aber wenn Ich habe getan, dass es nicht funktioniert hat. Hat jemand Ideen, wie man damit umgeht?
Dies macht keinen Sinn .. Wenn der Benutzer Berechtigungen für die gespeicherte Prozedur aspnet_Users_DeleteUser ausgeführt hat, sollten die SELECT-Berechtigungen für die Ansicht keine Rolle spielen. Genauso wenig wie DELETE-Berechtigungen für eine beliebige der Aspnet-Tabellen. – Matt