title: An attempt to attach an auto-named database for file ....database1.mdf failed
body: <p>I am getting the following error while debugging my visual studio 2010 website:</p>
  
  <blockquote>
    <p>An attempt to attach an auto-named database for file C:\Users...\Desktop\Dpp2012New\App_Data\dppdatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.</p>
    
    <p>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.</p>
    
    <p>Exception Details: System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Users...\Desktop\Dpp2012New\App_Data\dppdatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.</p>
  </blockquote>
  
  <p>Here is my connection string from my <code>web.config</code>:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="ApplicationServices" 
           connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
           providerName="System.Data.SqlClient"/&gt;
      &lt;add name="ConnectionString" 
           connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dppdatabase.mdf;Integrated Security=SSPI" 
           providerName="System.Data.SqlClient"/&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>And I access it from my website as:</p>
  
  <pre><code>Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
  </code></pre>
  
  <p>The stacktrace shows the error line as:</p>
  
  <pre><code> Dim conn As New SqlConnection(connectionString)
   Dim dr As SqlDataReader
   conn.Open() 'This is the error line as per stacktrace
  </code></pre>
  
  <p>I have given the needed permissions to the above folder so it can not be the " or specified file cannot be opened" issue. If we look at all the posts related to the same error in this forum, clearly the profoundness of this error can be found out. However, none of the solutions solves my issue.
  Some of the resources which I have tried are: </p>
  
  <ol>
  <li><a href="http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx" rel="noreferrer">http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx</a></li>
  <li><a href="http://blogs.msdn.com/b/webdevelopertips/archive/2010/05/06/tip-106-did-you-know-how-to-create-the-aspnetdb-mdf-file.aspx" rel="noreferrer">http://blogs.msdn.com/b/webdevelopertips/archive/2010/05/06/tip-106-did-you-know-how-to-create-the-aspnetdb-mdf-file.aspx</a></li>
  <li><a href="http://forums.asp.net/t/1033225.aspx" rel="noreferrer">http://forums.asp.net/t/1033225.aspx</a></li>
  </ol>
  
  <p>I eagerly await a solution.</p>