EntityFramework6.Npgsql icon indicating copy to clipboard operation
EntityFramework6.Npgsql copied to clipboard

System.InvalidOperationException: Connection is not open, when using EntityFramework

Open Corstiaan84 opened this issue 8 years ago • 1 comments

My app runs fine initially but after a couple of requests, I get the error below.

I am a bit lost as the stack trace gives no clue as to where in my own code this could be fixed. Any ideas?

running mono btw

System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: Connection is not open
  at Npgsql.NpgsqlConnection.CheckReadyAndGetConnector () <0x411d0940 + 0x00097> in :0 
  at (wrapper remoting-invoke-with-check) Npgsql.NpgsqlConnection:CheckReadyAndGetConnector ()
  at Npgsql.NpgsqlCommand.CheckReadyAndGetConnector () <0x411d07b0 + 0x00043> in :0 
  at Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal (CommandBehavior behavior) <0x411d0690 + 0x0001b> in :0 
  at Npgsql.NpgsqlCommand.ExecuteDbDataReader (CommandBehavior behavior) <0x411d0660 + 0x00013> in :0 
  at System.Data.Common.DbCommand.ExecuteReader (CommandBehavior behavior) <0x414a0ba0 + 0x00018> in :0 
  at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand:ExecuteReader (System.Data.CommandBehavior)
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.b__c (System.Data.Common.DbCommand t, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext`1 c) <0x414a1400 + 0x00027> in :0 
  at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[TInterceptor].Dispatch[TTarget,TInterceptionContext,TResult] (System.Data.Entity.Infrastructure.Interception.TTarget target, System.Func`3 operation, System.Data.Entity.Infrastructure.Interception.TInterceptionContext interceptionContext, System.Action`3 executing, System.Action`3 executed) <0x4104d890 + 0x0010e> in :0 
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader (System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext interceptionContext) <0x414a1060 + 0x00263> in :0 
  at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader (CommandBehavior behavior) <0x414a0bd0 + 0x000e6> in :0 
  at System.Data.Common.DbCommand.ExecuteReader (CommandBehavior behavior) <0x414a0ba0 + 0x00018> in :0 
  at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand:ExecuteReader (System.Data.CommandBehavior)
  at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands (System.Data.Entity.Core.EntityClient.EntityCommand entityCommand, CommandBehavior behavior) <0x4149bbf0 + 0x00043> in :0 
  --- End of inner exception stack trace ---
  at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands (System.Data.Entity.Core.EntityClient.EntityCommand entityCommand, CommandBehavior behavior) <0x4149bbf0 + 0x000b3> in :0 
  at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType] (System.Data.Entity.Core.Objects.ObjectContext context, System.Data.Entity.Core.Objects.ObjectParameterCollection parameterValues) <0x41498580 + 0x000a4> in :0 
  --- End of inner exception stack trace ---
  at Nancy.NancyEngine.InvokeOnErrorHook (Nancy.NancyContext context, Nancy.ErrorPipeline pipeline, System.Exception ex) <0x41567750 + 0x002c3> in :0 

Corstiaan84 avatar Aug 22 '16 11:08 Corstiaan84

I also made a SO thread about this: http://stackoverflow.com/questions/39078921/entityframework-postgres-system-invalidoperationexception-connection-is-not

Corstiaan84 avatar Aug 22 '16 16:08 Corstiaan84