title: .Net Sql Connection - "The network name cannot be found" from one solution
body: <p>We have a setup on some machines using a database alias as some development environments have Express, while others have full SQL.</p>
  
  <p>I've started getting a strange error in one of my solutions that uses the (local) alias to route to localhost\sqlexpress version. It's only started occurring in the last two weeks, and there is nothing actually wrong with the alias.</p>
  
  <p>The error we are getting in this solution is:</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>We have tested this connection locally, in SqlManagement Studio and in a separate solution, and it works fine in all other scenarios.</p>
  
  <p>When I run the following code in the immediate window of the two instances of visual studio i am running, one works fine, and the other throws the above exception:</p>
  
  <pre><code>new SqlConnection("Data Source=(local);Initial Catalog=CATALOG;Persist Security Info=True;user id=USERNAME;password=PASSWORD;Application Name=APPNAME Local").Open()
  </code></pre>
  
  <p>This is one of the strangest things I've ever seen. I am wondering if there could be some kind of alias override at the project level that I'm unaware of, or anything else that would affect a connection string on a project basis.</p>
  
  <p>All help appreciated.</p>
  
  <p>UPDATE:
  Hi guys, thanks for the feedback. But I would like to stress that this connection string is <strong><em>valid and works in all other scenarios on the same machine</em></strong> outside of the one solution it does not work in. I've tested this with both Named Pipes and TCP/IP and it is the same for both scenarios.</p>