1

I have a local Sitecore 8.2 instance.
Whenever, I browse this instance for the first time in a day or each time I deploy a dll, it throws this error:

Cannot open database "MySiteSitecore_Web" requested by the login. The login failed. Login failed for user 'sa'.

To fix this, I have to restart the SQL service. I check the databases if they have gone into recovery mode, but they are good. The DB is also installed in my local machine.

Why does this happen every time and how can I resolve this.

Stack Trace:

[SqlException (0x80131904): Cannot open database "CorlateSitecore_Web" requested by the login. The login failed. Login failed for user 'sa'.] System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +353
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +118
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +268
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +315
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
1 retry) +128
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +265 System.Data.SqlClient.SqlConnection.Open() +133
Sitecore.Data.DataProviders.Sql.DataProviderCommand..ctor(IDbCommand command, DataProviderTransaction transaction, Boolean openConnection) +113 Sitecore.Data.DataProviders.Sql.<>c__DisplayClass4.<CreateCommand>b__3() +48 Sitecore.Data.DataProviders.NullRetryer.Execute(Func
1 action, Action recover) +293
Sitecore.Data.DataProviders.Sql.<>c__DisplayClass12.b__10() +30 Sitecore.Data.DataProviders.NullRetryer.Execute(Func1 action, Action recover) +293
Sitecore.Data.DataProviders.Sql.SqlDataApi.CreateReader(String sql, Object[] parameters) +281
Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetContentLanguages() +189 Sitecore.Data.DataProviders.Sql.SqlDataProvider.LoadLanguages() +133
Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetLanguages() +49
Sitecore.Data.SqlServer.SqlServerDataProvider.ExecuteLoadItemDefinitionsSql(String sql, Object[] parameters, SafeDictionary
2 prefetchData) +90
Sitecore.Data.DataProviders.Sql.SqlDataProvider.EnsureInitialPrefetch() +359 Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetPrefetchData(ID itemId) +43
Sitecore.Data.DataProviders.Sql.SqlDataProvider.GetItemDefinition(ID itemId, CallContext context) +9
Sitecore.Data.DataProviders.DataProvider.GetItemDefinition(ID itemID, CallContext context, DataProviderCollection providers) +156
Sitecore.Data.DataSource.GetItemInformation(ID itemID) +88
Sitecore.Data.DataSource.GetItemData(ID itemID, Language language, Version version) +31
Sitecore.Nexus.Data.DataCommands.GetItemCommand.GetItem(ID , Language , Version , Database ) +113
Sitecore.Nexus.Data.DataCommands.GetItemCommand.Execute(ID , Language , Version , Database ) +496
Sitecore.Data.Engines.DataCommands.GetItemCommand.DoExecute() +142
Sitecore.Data.Engines.EngineCommand2.Execute() +93
Sitecore.Data.Managers.ItemProvider.GetItem(ID itemId, Language language, Version version, Database database) +295
Sitecore.Data.Managers.ItemProvider.GetItem(ID itemId, Language language, Version version, Database database, SecurityCheck securityCheck) +141
Sitecore.ContentTesting.Pipelines.ItemProvider.GetItem.GetItemUnderTestProcessor.Process(GetItemArgs args) +141 (Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +475
Sitecore.Data.Managers.DefaultItemManager.GetItem(String itemPath, Language language, Version version, Database database, SecurityCheck securityCheck) +297
Sitecore.Data.Managers.DefaultItemManager.GetItem(String itemPath, Language language, Version version, Database database) +147
Sitecore.Data.Managers.ItemManager.GetItem(String itemPath, Language language, Version version, Database database) +154
Sitecore.FXM.Matchers.DomainMatcherRepository.GetAllDomainMatchers(IDatabase database) +84 Sitecore.FXM.Sites.FxmSiteProvider.GetFxmSites() +199 Sitecore.FXM.Sites.FxmSiteProvider.get_FxmSites() +100
Sitecore.FXM.Sites.FxmSiteProvider.GetSites() +88
System.Linq.<SelectManyIterator>d__17
2.MoveNext() +529
Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites) +221
Sitecore.Sites.SitecoreSiteProvider.GetSites() +225
Sitecore.Sites.DefaultSiteContextFactory.GetSites() +232
Sitecore.Sites.DefaultSiteContextFactory.GetSiteContext(String hostName, String fullPath, Int32 portNumber) +122
Sitecore.Pipelines.HttpRequest.SiteResolver.ResolveSiteContext(HttpRequestArgs args) +430
Sitecore.Pipelines.HttpRequest.SiteResolver.Process(HttpRequestArgs args) +50 (Object , Object[] ) +74
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +475
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Nexus.Web.HttpModule.(Object , EventArgs ) +515
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93

  • can you make sure db_owner membership is checked for your user and database? – Mahendra Shekhawat Dec 18 '19 at 8:55
  • @MahendraShekhawat . Which user? System or Sitecore. Also, if it wasn't, it should always throw the error. right? – Qwerty Dec 18 '19 at 9:36
  • SQL user, "sa" in your case I guess. – Mahendra Shekhawat Dec 18 '19 at 10:09
  • Is the database set to Single User Mode? – sitecorium Dec 20 '19 at 10:51
  • Just wonder if your SQL Server service has Start Mode = "Automatic", what could really be an issue after your Windows OS is restarted – i123fr3 Dec 20 '19 at 11:41
1

Since this is happening every time you publish a dll, it does make me feel like publishing ìs overriding your writing permissions to database. Does your .pubxml file contains the following?

<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination>
  • No it is not present in my Visual Studio project's Local.pubxml file – Qwerty Dec 20 '19 at 11:17
  • 1
    Can you add and try publishing? it might be the problem – Tutku Can Yalcin Dec 20 '19 at 12:43
  • Did not work. It still shows the same error after publish – Qwerty Dec 20 '19 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.