title: Getting 12154: TNS:could not resolve the connect identifier specified error with .NET
body: <p>I've written this simple connection in my code:</p>
  
  <pre><code>OracleConnection con = new OracleConnection("Data Source=ORCL;User    
    ID=agapus;Password=agap");
  con.Open();
  </code></pre>
  
  <p>Then I run my application pressing F5 and I get the above error. This error occurs no matter if it's just a simple console app or an ASP.NET web site. I've tried both Oracle.DataAccess and the old windows oracle API. I've tried several Oracle services, all with no luck.
   The environment where I'm testing this connection is a Windows Server 2008R2. I can easily connect to any database using SQLPlus or TOAD. I've tried explicitly specifying the location of the TNS_NAMES.ORA file, doesn't work either.
   The only thing that works is when I specify the full path in the connection string. So if I change the above code into the below one, it'll work:</p>
  
  <pre><code>string conString = "user id=agapus;password=agap;data source=(DESCRIPTION=(ADDRESS=     
    (PROTOCOL=tcp)(HOST=172.16.0.121)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))";
    ID=agapus;Password=agap");
  OracleConnection con = new OracleConnection(conString);
  con.Open();     
  </code></pre>