Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'
Hi,
Getting the below error when trying to install the uBlogsy package. FYI - am running the latest version of Umbraco and uBlogsy (downloaded last night), manual install on Windows Server 2008 running SQL 2008 R2. Umbraco install was done manually as per the instructions on the Umbraco website.
If there's any SQL statements I can execute now in order to get this to install, or any other info needed, please let me know.
Thanks, Chris
Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert
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_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
The statement has been terminated.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
That suggests that there is already an row in the table (cmsContentTypeAllowedContentType) with the primary key.
Not 100% sure but it could be down to something in the UnitOfWork i.e. it is assigning the same id twice rather than generating a new id for each item.
Stabbign in the dark a bit as I am not sure of the code that caused this. Have you got an idea of what generated the error and can you post the code?
That's pretty weird as we have tested the installation of uBlogsy prior to releasing 6.0.3. We even have unit tests in the Core with the uBlogsy XML, so a bit surprised to see this type of error. But did you have any Document Types in your site prior to installing uBlogsy?
The stack trace you posted indicates that a relation for the structure of doc types already exists, so I can only see this happening if its finding an existing doc type and *thinks* that is the correct one to create a relation for (and this is only a relation in terms of allowed content types - eg the table cmsContentTypeAllowedContentType).
5 responses - excellent! Thanks for all your feedback.
It's pretty clear something went catastrophically south during the initial install of Umbraco and/or uBlogsy (which was no doubt my doing as it was a manual install). As I had no other previous content I decided to wipe the Umbraco database and website, reapplied permissions then reinstalled. This time around the uBlogsy package was uploaded without any errors.
I was hesitant about using uBlogsy owing to the "perceived" lack of support, compared to the likes of Wordpress et al. The responses in this thread have completely eradicated those concerns. Thanks again.
Can you tell us exactly what you mean by "which was no doubt my doing as it was a manual install"
We all want a bug free Umbraco and any issues we can stamp out would be great.
ps. I'm a busy boy but I try to help whenever I can. Of course I'm not always available... Just ask a question here, and tweet a link to it on twitter with #umbraco. You'll almost always get a response.
I'm not 100% sure TBH, Anthony. What I did notice this time around doing the Umbraco installation manually is that one of the pages on the installation wizard told me that specific folders did not have the correct permissions settings applied. Although I did modify an execute the batch file which configured access for the IIS APPPOOL\xxx user, I did not set such permissions during the initial install, and did not notice this warning the first time when installing.
Getting ahead of myself during the initial install, I uploaded the uBlogsy package remotely. It was then the first error was observed, but the details of the error were hidden owing to the site configuration. I'm wondering now if this error was perhaps some sort of permissions issue as the installer tried to copy files to the site...?
I then remote desktop'ed to the site and tried applying the package again. This time around the above mentioned SQL foreign key error was displayed.
When connecting earlier today I noticed multiple "uBlogsy" instances underneath "Installed Packages". Tried uninstalling these and applying the package again, but was getting the same foreign key error.
BTW, a manual install of Umbraco seemed to be my only option. I tried using the Platform Web Installer, but it did not seem to want to recognise my existing SQL 2008 R2 instance, forcing me to download SQL Express.
Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'
Hi,
Getting the below error when trying to install the uBlogsy package. FYI - am running the latest version of Umbraco and uBlogsy (downloaded last night), manual install on Windows Server 2008 running SQL 2008 R2. Umbraco install was done manually as per the instructions on the Umbraco website.
If there's any SQL statements I can execute now in order to get this to install, or any other info needed, please let me know.
Thanks, Chris
Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert
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_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
The statement has been terminated.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6387805
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +6389506
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +538
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +689
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327
Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) +2958
Umbraco.Core.Persistence.Database.Insert(Object poco) +58
Umbraco.Core.Persistence.Repositories.ContentTypeBaseRepository`2.PersistUpdatedBaseContentType(ContentTypeDto dto, IContentTypeComposition entity) +4427
Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PersistUpdatedItem(IContentType entity) +909
Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) +65
Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() +376
Umbraco.Core.Services.ContentTypeService.Save(IEnumerable`1 contentTypes, Int32 userId) +380
Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId) +1024
umbraco.cms.businesslogic.packager.Installer.InstallBusinessLogic(Int32 packageId, String tempDir) +1858
umbraco.presentation.developer.packages.Installer.ProcessInstall(String currentStep) +701
umbraco.presentation.developer.packages.Installer.Page_Load(Object sender, EventArgs e) +618
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
umbraco.BasePages.BasePage.OnLoad(EventArgs e) +19
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Are you running under full trust?
[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_cmsContentTypeAllowedContentType'. Cannot insert duplicate key in object 'dbo.cmsContentTypeAllowedContentType'.
That suggests that there is already an row in the table (cmsContentTypeAllowedContentType) with the primary key.
Not 100% sure but it could be down to something in the UnitOfWork i.e. it is assigning the same id twice rather than generating a new id for each item.
Stabbign in the dark a bit as I am not sure of the code that caused this. Have you got an idea of what generated the error and can you post the code?
That's pretty weird as we have tested the installation of uBlogsy prior to releasing 6.0.3. We even have unit tests in the Core with the uBlogsy XML, so a bit surprised to see this type of error. But did you have any Document Types in your site prior to installing uBlogsy?
The stack trace you posted indicates that a relation for the structure of doc types already exists, so I can only see this happening if its finding an existing doc type and *thinks* that is the correct one to create a relation for (and this is only a relation in terms of allowed content types - eg the table cmsContentTypeAllowedContentType).
- Morten
Would it help to get an idea of what is already in the cmsContentTypeAllowedContentType table?
To get this run a select in SQL Management studio again the table and output result to text rather than a table, you could copy and paste that.
Hey guys, this guy had a similar problem. He had it during uBlogsy install, AND during an Umbraco install
http://our.umbraco.org/projects/starter-kits/ublogsy/ublogsy-bugs/39446-Installation-timed-out
There's another stack trace which may help.
5 responses - excellent! Thanks for all your feedback.
It's pretty clear something went catastrophically south during the initial install of Umbraco and/or uBlogsy (which was no doubt my doing as it was a manual install). As I had no other previous content I decided to wipe the Umbraco database and website, reapplied permissions then reinstalled. This time around the uBlogsy package was uploaded without any errors.
I was hesitant about using uBlogsy owing to the "perceived" lack of support, compared to the likes of Wordpress et al. The responses in this thread have completely eradicated those concerns. Thanks again.
Good to hear that you got it working Chris.
Can you tell us exactly what you mean by "which was no doubt my doing as it was a manual install"
We all want a bug free Umbraco and any issues we can stamp out would be great.
ps. I'm a busy boy but I try to help whenever I can. Of course I'm not always available... Just ask a question here, and tweet a link to it on twitter with #umbraco. You'll almost always get a response.
I'm not 100% sure TBH, Anthony. What I did notice this time around doing the Umbraco installation manually is that one of the pages on the installation wizard told me that specific folders did not have the correct permissions settings applied. Although I did modify an execute the batch file which configured access for the IIS APPPOOL\xxx user, I did not set such permissions during the initial install, and did not notice this warning the first time when installing.
Getting ahead of myself during the initial install, I uploaded the uBlogsy package remotely. It was then the first error was observed, but the details of the error were hidden owing to the site configuration. I'm wondering now if this error was perhaps some sort of permissions issue as the installer tried to copy files to the site...?
I then remote desktop'ed to the site and tried applying the package again. This time around the above mentioned SQL foreign key error was displayed.
When connecting earlier today I noticed multiple "uBlogsy" instances underneath "Installed Packages". Tried uninstalling these and applying the package again, but was getting the same foreign key error.
BTW, a manual install of Umbraco seemed to be my only option. I tried using the Platform Web Installer, but it did not seem to want to recognise my existing SQL 2008 R2 instance, forcing me to download SQL Express.
We managed to find and isolate the issue that was originally posted in this thread. The problem revolves around re-importing doc types or re-installing a package with doc types where a structure exists. More info here: http://our.umbraco.org/projects/developer-tools/usync/usync/39722-Error-with-read-in-Umbraco-603-plus-uSync-112?p=2#comment145469
The fix will be part of 6.0.4
- Morten
is working on a reply...