title: Service-Based Database Entity Framework Connection Error On released version
body: <p>I am writing a Windows Forms application, where I want to save data inside the application. For the reason I used a serviced-based database with a <code>.mdf</code> database file, and I use Entity Framework.</p>
  
  <p>So far everything is working fine until I released the file and opened it on another computer. The application opened and everything worked fine but when it comes to the database interaction, it throws a big error like this:</p>
  
  <blockquote>
    <p>************ Exception Text ************<br>
    System.Data.Entity.Core.EntityException: The underlying provider failed on Open. </p>
    
    <p>System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.)</p>
  </blockquote>
  
  <p>Here a screenshot of the error: <a href="https://www.dropbox.com/s/gwban6ab97c6fya/22093543_10213995193571435_760919436_n.png?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/gwban6ab97c6fya/22093543_10213995193571435_760919436_n.png?dl=0</a></p>
  
  <p>In case you need the project its uploaded to here: <a href="https://www.dropbox.com/s/ubpc683ggtihh6k/usercontrol.zip?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/ubpc683ggtihh6k/usercontrol.zip?dl=0</a></p>
  
  <p>I have tried in so many ways but nothing is working, same thing happens for the installer version as well.</p>
  
  <p>Can anyone help me on this please?</p>
  
  <p>Here are my connection strings:</p>
  
  <pre><code>&lt;add name="DatabaseEntities" 
       connectionString="metadata=res://*/dbModel.csdl|res://*/dbModel.ssdl|res://*/dbModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\Database.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;"  
       providerName="System.Data.EntityClient" /&gt;
  &lt;add name="OPLCheque.Properties.Settings.DatabaseConnectionString" 
       connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True" 
       providerName="System.Data.SqlClient" /&gt;
  </code></pre>