Azure数据同步错误 - INSERT语句与FOREIGN KEY约束冲突

时间:2017-01-26 17:24:45

标签: azure azure-sql-database asp.net-identity-2 azure-data-sync

我使用Azure Data Sync来同步两个也包含ASP.NET身份表的数据库。

直到几天前,当我在Hub数据库中插入大约1500个用户时,一切正常。从那时起,我收到以下错误:

Sync failed with the exception "GetStatus failed with exception:Sync worker failed, checked by GetStatus method. 
Failure details:Sync was aborted because more than 1000 changes failed to apply. 
Examine your table schemas to look for conflicting constraints or incompatible data types that may prevent sync from succeeding.
Upload - errors for first 5 rows that failed to apply:
Error #1: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId". 
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. 
Error #2: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId". 
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. 
Error #3: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId". 
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. 
Error #4: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId". 
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. 
Error #5: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId". 
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. "   

在我看来,Sync正在尝试在AspNetUserClaims表中插入值,然后将它们插入AspNetUsers(这是主表),但这不应该发生。

有什么想法吗?

0 个答案:

没有答案