title: Service-based Database run time error / Local DB instance does not exist or not accessible
body: <p>I've recently built an app that makes use of the service-based database to store its data because the binding seems easy for a beginner.</p>
  <p>Everything worked well in debug, but this error appears when I published it using the &quot;click once install&quot; publish option. Please note that I used the wizard and not the &quot;Publish now&quot; option, so the manifest is correct.</p>
  <p>I've also checked in the prerequisites to install .Net Framework 4.8 &amp; SQL Server Express Local DB 2012 before installing the app, and the installation also worked fine. I could see the SQL Server Running in task manager.</p>
  <p>Publish settings:</p>
  <p><a href="https://i.stack.imgur.com/Qtsr4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qtsr4.png" alt="Publish settings" /></a></p>
  <p>SQL Server Running:</p>
  <p><a href="https://i.stack.imgur.com/cQThr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cQThr.png" alt="SQL Server Running" /></a></p>
  <p>Here is the app.config code</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
      &lt;/configSections&gt;
      &lt;connectionStrings&gt;
          &lt;add name=&quot;Redo_V3.Properties.Settings.CNv3&quot; connectionString=&quot;Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\RedoV3Database.mdf;Integrated Security=True&quot;
              providerName=&quot;System.Data.SqlClient&quot; /&gt;
      &lt;/connectionStrings&gt;
      &lt;startup&gt; 
          &lt;supportedRuntime version=&quot;v4.0&quot; sku=&quot;.NETFramework,Version=v4.7.2&quot; /&gt;
      &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>Here
  <a href="https://i.stack.imgur.com/hDFhD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hDFhD.png" alt="" /></a>
  is the error message</p>
  <p>Please note that I've tested this app initially on a PC, and then on a VM in Virtual Box</p>
  <p>Is there something wrong with my connection string? Or what could be the cause of this?</p>