Try our conversational search powered by Generative AI!

Violation of Primary Key constraint 'PK_tblWindowsRelations'.

Violation of Primary Key constraint 'PK_tblWindowsRelations'. Cannor insert duplicate keys object 'tblwindowsRelations'. Only occurs on some AD-accounts which might point to troubles with nested groups or trusted domains? Using windowsMembershipProvider on windows 2003 EPiServer CMS 5.1.422.4 Any suggestions?
Nov 16, 2007 14:13
We have managed to sort out the groups causing the trouble and it seems that groups migrated from a trusted domain gest duplicated in tblWindowRelations. But still no solution other then removing the PK_Constraint...
Nov 16, 2007 14:32
Hi, I have the same problem with Episerver 5 SP1, version 5.1.422.122. For some AD accounts the EpiServer works without any problem and for some accounts it gives me exception: Violation of PRIMARY KEY constraint 'PK_tblWindowsRelations'. Cannot insert duplicate key in object 'dbo.tblWindowsRelations'. The statement has been terminated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_tblWindowsRelations'. Cannot insert duplicate key in object 'dbo.tblWindowsRelations'. The statement has been terminated. Have you got now some solution for this problem? Best Regards Vlada
Feb 25, 2008 15:35

Hi. Late response but might help someone. The problem still occurs and is most likely caused by trust relationships between domains. The easy fix is to simply remove the primary key on tbl_windowsrelations. The problem still occurs in CMS 5 R2.


Nov 05, 2008 16:14


EPiServer has two updated stored procedures that will fix this issue.

The problem still exists in SP3.



Dec 01, 2008 10:10


This is a known issue in which according to buglist should be fixed in EPiServer CMS R1 SP2,

#8865 Logging on with the Windows membership provider will sometimes give a "violation of primary key constraint"

There is a hotfix available from EPiServer Developer Support


Dec 01, 2008 21:36

Yes I've been told that this is a known issue and it should be fixed in SP2 but we are now running R2 and the problem still occurs. I've got the two SP's now and will try them out as soon as i get the time.

For everybody from EPiServer reading this, there is also an open supportcase (119334 ) regarding this case.

Dec 08, 2008 8:30
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.