Apology for this strangely worded question. I don\'t know what the actual problem is but hopefully someone can give me some insights.
I am getting the following error wh
An FYI EF Migrations pull their timeout from a separate configuration:
public class MyContextConfiguration : DbMigrationsConfiguration<MyContext>
{
public MyContextConfiguration()
{
CommandTimeout = 900;
}
}
Change the 900 to a something higher, all of the other SQL timeout changes (web.config, etc.) did not do anything, this worked for me.
For me, the problem was that that migration script took a long time to run (15 minutes).
This is how I worked around the issue:
1. Run update-database -script
(-force
may be necessary)
2. Copy this SQL script output and run in SQL Server Management Studio
I ran into this in my production environment because it was producing queries like the ones here: Why does Entity Framework 6 generate complex SQL queries for simple lookups?
This is actually related to a bug in this version of EF: https://entityframework.codeplex.com/workitem/2083
They changed the default null semantics from 5 to 6 so I'm guessing you had the same problem I did after upgrading. My machine had a fraction of the data as my remote installation and until I got to production I didn't know I had a performance issue. The queries will often produce a table scan which will time out for larger tables.
To change it back so that it works like EF5 you have to set:
DbContextConfiguration.UseDatabaseNullSemantics = true
See here: http://msdn.microsoft.com/en-us/library/system.data.entity.infrastructure.dbcontextconfiguration.usedatabasenullsemantics(v=vs.113).aspx
The bug was fixed in EF 6.1 but you still have to set the option above to get simple where conditions.
In the constructor of Configuration.cs class (in migration Folder) add the property CommandTimeout = Int32.MaxValue;
I just had the same exact issue, i know this thread is a year old but maybe it will help someone else.
I was trying to create the database in entity 5 using the Package Manager Console using the connection string below.
update-database -ConfigurationTypeName My.Project.EF.Migrations.Configuration -ConnectionStringName MyDatabaseDev -ProjectName Project.Name -StartUpProjectName Database.Name
Each time i ran it i got the error below.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
To fix it i simply added the -force parameter and it went right through.
I restarted the SQL Server service (Win7 - Computer Management > Services and Applications > Services)