6

我正在使用 Azure 数据同步来同步两个还包含 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 在将值插入 AspNetUsers(这是主表)之前尝试在 AspNetUserClaims 表中插入值,但这不应该真的发生。

有任何想法吗?

4

0 回答 0