Search code examples
c#sql-serverentity-frameworksql-server-2008-r2sqlconnection

EntityFramework creating 130+ connections


According to MSDN, entity framework is supposed to close its connections after a specific operation (e.g. SaveChanges()).

Amazon is barking at me about too many connections in my SQL Server instance (140 connections). 100 of these connections in sp_who2 display a ProgramName of "EntityFramework".

Is it OK for EF to create all these connections? Is there an application level clean up that is missing? Would initiating periodic garbage collection help clean these up?


Solution

  • Looks like there is a problem with Ninject closing DB contexts ...

    http://bobcravens.com/2010/11/using-ninject-to-manage-critical-resources/