Visual Studio connects to database, but application within using the same connection string cannot
<p>Using SSMS and Visual Studio 2015's <code>Server Explorer</code> tab under <code>Data Connections</code>, I can execute queries on remote server KOSH without issue. Why is the MVC application running locally in Visual Studio/IIS Express unable to do the same?</p>

<p>Using VS2015's connection <code>Properties</code>, I get its connection string:</p>

<pre><code>Data Source=123.456.78.9;Persist Security Info=True;User ID=Foo;Password=Bar
</code></pre>

<p>Using that connection string, the MVC application is greeted with:</p>

<blockquote>
  <p>"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: Named
  Pipes Provider, error: 40 - Could not open a connection to SQL
  Server)"</p>
</blockquote>

<p>Inner exception message:</p>

<blockquote>
  <p>"The network path was not found"</p>
</blockquote>

<p>I know the server/firewall/network settings are correct. That leaves the application.</p>

<pre><code>using(var connection = Database.Connection(conInfo.ConnectionString, provider)) {
    // rowCountSql: SELECT SUM(rows) TM_ROWCOUNT FROM sys.partitions
    //              WHERE object_id = object_id(@tableName) and index_id IN (0,1)
    // Any other SQL yields same error
    var countTask = connection.QueryAsync(rowCountSql, new { tableName = Editor.TableName });
}
</code></pre>

<p>Async is used because the Oracle version of the query can take several seconds to return.
The application should be correct because it connects to the same server from home (also the server's location) and to identical databases in remote data centers running 2008R2 to 2014 without a problem.</p>

<p><code>Database.Connection()</code> is:</p>

<pre><code>// This is unlikely to be the problem as it is very well tested
public static DbConnection Connection(string connectionString, string databaseProvider) {
    DbProviderFactory databaseFactory = DbProviderFactories.GetFactory(databaseProvider);
    DbConnection connection = databaseFactory.CreateConnection();
    if(connection != null)
        connection.ConnectionString = connectionString;
    return connection;
}
</code></pre>

<p>I bet I am missing something simple, but I would be grateful for help on what that could be.</p>