ASP.Net can't see my database from the ISS
<p>I decided to learn how to make a simple ASP.Net project, with a <em>reference</em> to a database project through the Repository Pattern.</p>

<p>I have my Controller calling for a <code>List&lt;Weight&gt;</code> to handle:</p>

<pre><code>public IActionResult MyWeight()
{
    var repo = new Database.Repositories.WeightRepository();
    var data = repo.GetWeight().Result;

    return View(data);
}
</code></pre>

<p>When <code>repo.GetWeight()</code> is called, I get an <code>AggregateException</code> error, with an inner exception saying:</p>

<pre><code>"No connection string named 'MyDatabaseConnection' could be found in the application config file."
</code></pre>

<p>So for clarity, let me outline the solution's structure:</p>

<ul>
<li>aspProj

<ul>
<li>Controllers</li>
<li>Views</li>
<li>Service</li>
<li>App.config (1)</li>
<li>Web.config</li>
<li>...</li>
</ul></li>
<li>Database

<ul>
<li>Entities</li>
<li>Repositories</li>
<li>App.config (2)</li>
<li>...</li>
</ul></li>
<li>Database.Test

<ul>
<li>Test.cs</li>
<li>App.config (3)</li>
<li>...</li>
</ul></li>
</ul>

<p>I've added the following <code>connectionString</code> to all <code>App.config</code>s and the <code>Web.config</code>:</p>

<pre><code>&lt;connectionStrings&gt;
    &lt;add
        name="MyDatabaseConnection"
        connectionString="Data Source=(localdb)\MSSQLLocalDB;Integrated Security=True"
        providerName="System.Data.SqlClient"/&gt;
&lt;/connectionStrings&gt;
</code></pre>

<p>I have tested the database both from Visual Studio's <code>Server Explorer</code>, and through the <code>Test.cs</code> file from the test-project. I can insert data and retrieve without a problem.
But when the ASP.Net-part wants to access it, there is no love.</p>

<p>I thought it might be the ISS which did not know the path from where it is...</p>

<p>Any thoughts?</p>

<p>__</p>

<p><strong>Edit:</strong></p>

<p>My Web.config:
<a href="https://i.stack.imgur.com/Kw0ZR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kw0ZR.png" alt="enter image description here"></a></p>

<p>My AppSetting.json:
<a href="https://i.stack.imgur.com/ssF9I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ssF9I.png" alt="enter image description here"></a></p>