Return Code 0 / Primary Key Violation
We are getting a return code 0 when trying to upload images to specific image libraries. It only happens to 2 out of 14.
We did some initial debugging with Fiddler and error logs and we got a 504 response for url: /Sitefinity/Services/Content/ImageService.svc/parent/8aa19bae-14a6-4ee2-aca3-9d85a93e332c/00000000-0000-0000-0000-000000000000/?itemType=Telerik.Sitefinity.Libraries.Model.Image&provider=&parentItemType=Telerik.Sitefinity.Libraries.Model.Album
We also found this error: Insert link table row failed: Telerik.OpenAccess.RT.sql.SQLException: Voilation of PRIMARY KEY constraint 'pk_sf_lbrrs_sf_prmssns_nhrtnc_'. Cannot insert duplicate key
I have no idea what caused this. I found some similar posts about this that all seem to hit dead ends or go into support tickets.
What do I need to do to fix this?
We have replied to you in the support ticket. If you wish you can share the information with the community at a later moment.
the Telerik team
In our case this was happening for images and videos. If anyone has the same issue here is the SQL we used to resolve the issue.
We encounter the same problem on editing or deleting images:
Type : Telerik.OpenAccess.Exceptions.DuplicateKeyException, Telerik.OpenAccess, Version=2012.2.628.2, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
Message : Insert link table row failed: Telerik.OpenAccess.RT.sql.SQLException: Violation of PRIMARY KEY constraint 'pk_sf_lbrrs_sf_prmssns_nhrtnc_'. Cannot insert duplicate key in object 'dbo.sf_lbrrs_sf_prmssns_nhrtnc_map'. The duplicate key value is (9f2fb38d-8881-4953-a869-4ef84a258be0, 2051).
Is this solution still applicable to this problem?
The provided query is valid for the exception you are getting. What I would suggest however is to execute it on a backup copy of your project, before running it on the live server.
the Telerik team
That is what I did and it has fixed my problem.