title: Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database
body: <p>I have an application that access a database frequently for a number of functions. It was running fine for several days. I received a <code>System.Data.SqlClient.SqlException</code> exception this morning. The application wasn't doing anything out of the regular when this happened. Any Ideas on what caused this or how to prevent it in the future?</p>
  
  <p><strong>Windows Event Log</strong></p>
  
  <pre><code>NT AUTHORITY\SYSTEM 
     Reason: Failed to open the explicitly specified database. 
     [CLIENT: &lt;local machine&gt;] 
  </code></pre>
  
  <p><strong>Exception Stack Trace</strong></p>
  
  <pre><code>System.Data.SqlClient.SqlException (0x80131904): 
  Cannot open database ""MyDB"" requested by the login. The login failed.
  Login failed for user 'NT AUTHORITY\SYSTEM'.
     at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
     at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
     at System.Data.SqlClient.SqlConnection.Open()
     at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
     at System.Data.Linq.DataContext.SubmitChanges()
     at ***.SubmitContextChanges(DataContext dataContext, Int32 counter) in c:\Work\***.cs:line 332
  </code></pre>
  
  <p><strong>Windows event right after</strong></p>
  
  <pre><code>Attempting to load library 'xpstar.dll' into memory. 
   This is an informational message only. No user action is required.
  </code></pre>