No database instance

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 Jahre weitere
Hi
I riceved this error on a new server:


No database instance
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.ApplicationException: No database instance

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[ApplicationException: No database instance]
   Nop.Data.Initializers.CreateTablesIfNotExist`1.InitializeDatabase(TContext context) +1843
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +66
   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +596
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +208
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +266
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +72
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +64
   System.Linq.Queryable.OrderBy(IQueryable`1 source, Expression`1 keySelector) +85
   Nop.Services.Stores.StoreService.<GetAllStores>b__0() +358
   Nop.Core.Caching.CacheExtensions.Get(ICacheManager cacheManager, String key, Int32 cacheTime, Func`1 acquire) +337
   Nop.Core.Caching.CacheExtensions.Get(ICacheManager cacheManager, String key, Func`1 acquire) +149
   Nop.Services.Stores.StoreService.GetAllStores() +171
   Nop.Web.Framework.WebStoreContext.get_CurrentStore() +361
   Nop.Web.Framework.SettingsSource.<BuildRegistration>b__5(IComponentContext c, IEnumerable`1 p) +124
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +15
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +157
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.InstanceLookup.Execute() +181
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +170
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +333
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +157
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.InstanceLookup.Execute() +181
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +170
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +333
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +157
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.InstanceLookup.Execute() +181
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +168
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +57

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> No database instance (See inner exception for details.)]
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +293
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +168
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +117
   Nop.Core.Infrastructure.DependencyManagement.ContainerManager.Resolve(String key, ILifetimeScope scope) +263
   Nop.Core.Infrastructure.NopEngine.Resolve() +167
   SevenSpikes.Nop.Framework.InstallHelper.InstallLocaleResources(String pluginFolderName, String fileNameWithoutCultureAndExtension, Boolean updateExistingResources) +251
   SevenSpikes.Nop.Plugins.Core.RouteProvider.RJeq7SL2FhoyxG2xWh(Object , Object , Object , Boolean ) +20
   SevenSpikes.Nop.Plugins.Core.RouteProvider.InstallMissingResources() +152
   SevenSpikes.Nop.Framework.Routing.BaseRouteProvider.mWuLvl6oXHLoXInuiKG(Object ) +14
   SevenSpikes.Nop.Framework.Routing.BaseRouteProvider.RegisterRoutes(RouteCollection routes) +177
   Nop.Web.Framework.Mvc.Routes.<>c__DisplayClass3.<RegisterRoutes>b__1(IRouteProvider rp) +81
   System.Collections.Generic.List`1.ForEach(Action`1 action) +14232564
   Nop.Web.Framework.Mvc.Routes.RoutePublisher.RegisterRoutes(RouteCollection routes) +1014
   Nop.Web.MvcApplication.RegisterRoutes(RouteCollection routes) +223
   Nop.Web.MvcApplication.Application_Start() +366

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> No database instance (See inner exception for details.)]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12949749
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> No database instance (See inner exception for details.)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12966756
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12806561


The database exist. Why?
Thanks
9 Jahre weitere
Hi,

string connection is right?

Check also db permission.
9 Jahre weitere
Hi
this is the connection string:
DataProvider: sqlserver
DataConnectionString: Data Source=9X.2XX.7X.XX;Initial Catalog=D_XXX_XXX_db;User Id=XX_XXX_XXX;Password=PjQntAv32;Integrated Security=True;Persist Security Info=False

I connect with these data in SQL Management Studio
9 Jahre weitere
try with

Data Source=9X.2XX.7X.XX\"yoursqlservenameinstance"

or

Data Source="yournamemachine"

or

Data Source="yournamemachine"\"yoursqlservenameinstance"
9 Jahre weitere
I guess Integrated Security should be 'false' if you use SQL Server Authentication (user and password)
https://msdn.microsoft.com/it-it/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx
8 Jahre weitere
For future reference:
most likely your SQL user login password expired.
To fix the issue you need to:
Login SQL Management Studio
expand Logins
right click on login name for your DB and click properties
there just untick Enforce password policy
untick Enforce password expiration
click OK and you're done.

http://ringneck.xyz/sql.png
4 Jahre weitere
There are some of summery solution that i have mention as below
=> Since i had moved a live cart to a test server, the settings in the database for that cart had force ssl and also force www before any url. Also under Store settings i still had the domain info for that site which was now difrent in the test server. Once i noticed this and updated the database it all started working.

=>  You try change settings.txt file:
DataConnectionString: Data Source=localhost/IP;Initial Catalog=DBName;Integrated Security=False;Persist Security Info=False;User ID=DBUser;Password=DBPass;MultipleActiveResultSets=True

=> In my case I need config application pool for nopcomerce

my connection string
DataProvider: sqlserver
DataConnectionString: Data Source=.;Initial Catalog=nopcommerce370;Integrated Security=True;Persist Security Info=False

I need set Application Pool Identity to user has access right to db
Check the image to details.

=>  Check also db permission.

=> try with
Data Source=9X.2XX.7X.XX\"yoursqlservenameinstance"
or
Data Source="yournamemachine"
or
Data Source="yournamemachine"\"yoursqlservenameinstance"
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.