Server Error in '/' Application.

ExecuteReader requires an open and available Connection. The connection's current state is open.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is open.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is open.]
   System.Data.SqlClient.SqlConnection.GetOpenConnection(String method) +65
   System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +94
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +309
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +155
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +83
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +199
   System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +98
   System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +510
   System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +36

[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
   System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +125
   System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +1017
   System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +462
   System.Data.Entity.Core.Objects.<>c__DisplayClass41_0.<GetResults>b__0() +227
   System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +234
   System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +357
   System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0() +30
   System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +39
   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +264
   Mahbang.Domain.Concrete.SystemRepository.GetByName(String title) in D:\Web Programming\MyProjects\1402-VS2022\Book\src\Mahbang.Domain.Repository\Setting\SystemRepository.cs:80
   Mahbang.WebUI.Controllers.HomeController..ctor(IPageRepository repo, IPageCategoryRepository pcrepo, IMenuRepository mnurep, IStoreBrandRepository brandRepo, IBannerRepository bannerrep, ISystemRepository svrepo, IProductRepository prodrep, IStoreCategoryRepository storrep, IMediaRepository mediaRepo, IOrderRepository orderRep, IAccountingRepository accountRepo, IUserRepository userRepo, IGalleryRepository galleryRepo, IGalleryCategoryRepository galleryCatRepo, IClubRepository clubRepo, EFDbContext context) in D:\Web Programming\MyProjects\1402-VS2022\Book\src\Mahbang.WebUI\Controllers\HomeController.cs:46
   DynamicInjector80b76159519a43fa9e0de7244ab866a0(Object[] ) +707
   Ninject.Activation.Context.ResolveInternal(Object scope) +182
   Ninject.Activation.Context.Resolve() +283
   Ninject.KernelBase.Resolve(IRequest request, Boolean handleMissingBindings, Boolean filterImplicitBindings) +1386
   Mahbang.WebUI.Infrastructure.NinjectControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in D:\Web Programming\MyProjects\1402-VS2022\Book\src\Mahbang.WebUI\Infrastructure\NinjectControllerFactory.cs:27
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +265
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +77
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1128
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +220
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0