Code First migration timing out RRS feed

  • Question

  • During a Code First migration we are receiving an SqlException "Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding." We're running an SQL script in the Up method of the migration which performs a fairly large data fix and this exception is occurring as a result. The CommandTimeout property of the DbContext is being set to Int32.MaxValue and the SQL Server instance has its Remote query timeout property set to 0 (no limit). Any ideas on what we can to to get around this issue would be greatly appreciated.


    Friday, April 26, 2013 3:40 PM


  • I found that there is a CommandTimeout property on the migration configuration class as well. Once I set that to Int32.MaxValue we quit getting this exception.
    • Marked as answer by Dane Vinson Friday, April 26, 2013 10:05 PM
    • Edited by Dane Vinson Tuesday, April 30, 2013 12:12 AM
    Friday, April 26, 2013 10:05 PM

All replies