1

I'm using Entity Framework with SQLServer.

Now i want to decrease connection timeout and command timeout to about 10 seconds. This is my connection string

<connectionStrings>
<add name="PalletDataEntities" connectionString="metadata=res://*/Database.PalletDb.csdl|res://*/Database.PalletDb.ssdl|res://*/Database.PalletDb.msl;provider=System.Data.SqlClient;
     provider connection string=&quot;
     data source=00.0.000.000;
     initial catalog=Test;
     persist security info=True;
     user id=sa;password=####;
     Connection Timeout=2;
     MultipleActiveResultSets=True;
     App=EntityFramework&quot;"
   providerName="System.Data.EntityClient"/>
</connectionStrings>

I have found that you can use Default Command Timeout=10; for MYSQL connection strings but this don't work for MSSQL. can someone help me with fixing this or have an other solution to get the above given results.

Haithem KAROUI
  • 1,533
  • 4
  • 18
  • 39
quantum apps
  • 938
  • 2
  • 13
  • 25
  • 1
    Possible duplicate of [Entity Framework Timeouts](https://stackoverflow.com/questions/6232633/entity-framework-timeouts) – Jeroen Mostert Oct 23 '18 at 11:58
  • +1 for duplicate possibility... You can use DbContext.Database.CommandTimeout = 180; It's pretty simple and no cast required. – Haithem KAROUI Oct 23 '18 at 11:59

0 Answers0