6

I'm using Azure Data Sync to synchronise two databases which also contain ASP.NET Identity Tables.

Everything was working fine until a few days ago when I inserted around 1500 users in the Hub Database. Since then I'm getting the following error:

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. "   

It seems to me that the Sync is trying to insert values in the AspNetUserClaims table before inserting them into the AspNetUsers (which is the master table) but this shouldn't really happen.

Any ideas?

Florin D. Preda
  • 1,358
  • 1
  • 11
  • 25

0 Answers0