Error after DXC deployment

Vote:
 

I have noticed that from past few deployments to DXC I see this error 

"EPiServer.Cms.Shell.UI.Rest.ContentChangeManager : Unexpected error when saving 19234_158862
System.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkContentProperty_tblPropertyDefinition". The conflict occurred in database "epicms"", table "dbo.tblPropertyDefinition"", column 'pkID'.

However after redeployment this error is no more. Any inputs on why this error occurs and fixes after redeployment without any changes.
#218588
Mar 16, 2020 22:18
Santiago Morla - Feb 23, 2021 14:55
I was getting the same issue, especially if I had content type changes. The recommended practice is to select the "Use maintenance Page" option. As per Epi: Use maintenance page. If the deployment includes database schema updates or changes to content types, select to display a maintenance page while the site is offline. This will avoid those SQL errors.
Vote:
 

I have no experience with DXP (the experience platform formerly known as DXC) but I think you probably have done changes to a content type (added or removed a property, added or changed a page type or block type) after the previous deploy. If DXP has two deployment slots using the same database, two different versions of your code are fighting over the same database. 

After the second deploy, both slots will have the same code, and the fighting stops. I think this is the explanation. I do not know the solution.

A workaround could be running two consecutive deploys after a content type is changed. That is what I do when deploying an Episerver site to Azure (non-DXP) using deployment slots.

#218610
Edited, Mar 17, 2020 6:38
Vote:
 

Looks like one or more of your content types does not have a guid, causing mapping mismatch between strongly typed content types (code) and database. If that is the case then adding GUID property to ContentType attribute would solve the problem

#218611
Mar 17, 2020 7:15
Vote:
 

@Quan,

All of my content types do have GUID's and are created using EpiServer options so they definitely be same in Database vs code. I have not edited any of page types or manually added/edited guids.

For some reason I have seen that I dont get this issue when I use maintenance page when doing deployment. Not sure what the difference would be but for now am going to validate and use this option.

#219721
Apr 02, 2020 3:01
Vote:
 

Hi Dileep

One of my clients encountered the same issue recently. Client fixed this issue by quickly restart the WebApp. 

#220534
Apr 02, 2020 7:53
Vote:
 

Vincent, I have observed it too that a redeployment or restart of web app fixes it.

#220560
Apr 02, 2020 17:52
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.