An error occurred while starting the application NopCommerce v4.0

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi,

I have been using nopcommerce v4.0. While i have publish the code and moved to IIS i have getting the following error.

An error occurred while starting the application.
.NET Framework 4.7.2600.0 X86 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452    |    Microsoft Windows 10.0.16299    |   Need help?


I have enabled the stdoutLogEnabled="true" in web.config.

The full error stack as follows.

Application startup exception: Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = CDNPluginSettings (DelegateActivator), Services = [XcellenceIT.Plugin.CDN.CDNPluginSettings], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> No database instance (See inner exception for details.) ---> System.ApplicationException: No database instance
   at Nop.Data.Initializers.CreateTablesIfNotExist`1.InitializeDatabase(TContext context) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Data\Initializers\CreateTablesIfNotExist.cs:line 78
   at System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf`1.<CreateInitializationAction>b__e()
   at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
   at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
   at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
   at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
   at Nop.Services.Stores.StoreService.<>c__DisplayClass8_0.<GetAllStores>b__0() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 98
   at Nop.Services.Stores.StoreService.<>c__DisplayClass8_0.<GetAllStores>b__1() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 110
   at Nop.Core.Caching.CacheExtensions.Get[T](ICacheManager cacheManager, String key, Int32 cacheTime, Func`1 acquire) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Caching\Extensions.cs:line 48
   at Nop.Services.Stores.StoreService.GetAllStores(Boolean loadCacheableCopy) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 107
   at Nop.Web.Framework.WebStoreContext.get_CurrentStore() in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\WebStoreContext.cs:line 46
   at Nop.Web.Framework.Infrastructure.SettingsSource.<>c__2`1.<BuildRegistration>b__2_0(IComponentContext c, IEnumerable`1 p) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\Infrastructure\DependencyRegistrar.cs:line 301
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.<Execute>b__5_0()
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Nop.Core.Infrastructure.NopEngine.Resolve[T]() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 244
   at XcellenceIT.Plugin.CDN.Licensing.Validate..ctor()
   at XcellenceIT.Plugin.CDN.Licensing.ValidateStartUp.Execute()
   at Nop.Core.Infrastructure.NopEngine.RunStartupTasks(ITypeFinder typeFinder) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 65
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 205
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 51
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web\Startup.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception
Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = CDNPluginSettings (DelegateActivator), Services = [XcellenceIT.Plugin.CDN.CDNPluginSettings], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> No database instance (See inner exception for details.) ---> System.ApplicationException: No database instance
   at Nop.Data.Initializers.CreateTablesIfNotExist`1.InitializeDatabase(TContext context) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Data\Initializers\CreateTablesIfNotExist.cs:line 78
   at System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf`1.<CreateInitializationAction>b__e()
   at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
   at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
   at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
   at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
   at Nop.Services.Stores.StoreService.<>c__DisplayClass8_0.<GetAllStores>b__0() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 98
   at Nop.Services.Stores.StoreService.<>c__DisplayClass8_0.<GetAllStores>b__1() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 110
   at Nop.Core.Caching.CacheExtensions.Get[T](ICacheManager cacheManager, String key, Int32 cacheTime, Func`1 acquire) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Caching\Extensions.cs:line 48
   at Nop.Services.Stores.StoreService.GetAllStores(Boolean loadCacheableCopy) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Services\Stores\StoreService.cs:line 107
   at Nop.Web.Framework.WebStoreContext.get_CurrentStore() in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\WebStoreContext.cs:line 46
   at Nop.Web.Framework.Infrastructure.SettingsSource.<>c__2`1.<BuildRegistration>b__2_0(IComponentContext c, IEnumerable`1 p) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\Infrastructure\DependencyRegistrar.cs:line 301
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.<Execute>b__5_0()
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Nop.Core.Infrastructure.NopEngine.Resolve[T]() in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 244
   at XcellenceIT.Plugin.CDN.Licensing.Validate..ctor()
   at XcellenceIT.Plugin.CDN.Licensing.ValidateStartUp.Execute()
   at Nop.Core.Infrastructure.NopEngine.RunStartupTasks(ITypeFinder typeFinder) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 65
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration) in F:\Project\GCE\GCE.ECommerce\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 205
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 51
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services) in F:\Project\GCE\GCE.ECommerce\Presentation\Nop.Web\Startup.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Hosting environment: Production
Content root path: F:\GCE_Test
Now listening on: http://localhost:15336
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://10.10.100.57:82/  
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 59.5839ms 500 text/html; charset=utf-8
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://10.10.100.57:82/favicon.ico  
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.1509ms 500 text/html; charset=utf-8


Note: While publishing the dataSettings.json not created. I have manually copied the file to the hosted path.
The connected database working in my local environment. And also installed Core SDK
6 years ago
Hello,

Problem might be in your connection string please check your connection string..!!
6 years ago
sk5202 wrote:
Hello,

Problem might be in your connection string please check your connection string..!!


Hi sk,

Thanks for the reply.

I have checked the connection string its correct. The same connection string has been used in my local environment and working fine.
6 years ago
See if anything here helps:  https://www.nopcommerce.com/boards/t/26946/no-database-instance.aspx
6 years ago
Hi,

The issue has been fixed. I just gave the db access permission for my user credentials in application pools.

Thanks for all your replies.
6 years ago
sengottuvelum wrote:
Hi,

The issue has been fixed. I just gave the db access permission for my user credentials in application pools.

Thanks for all your replies.


Glad to know you found cause of problem.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.