Tim Tim - 1 year ago 94
ASP.NET (C#) Question

ASP.NET / Oracle issue: TNS Could not resolve the connect identifier specified

I've got a local copy of an ASP.NET web application running in Visual Studio 2010. The code is an exact duplicate of the code running on my dev environment.

When I try to connect to my Oracle database through ASP.NET, it throws a "TNS could not resolve the connect identifier specified." The weird thing is this database is in my TNSNAMES.ORA file, and when I use TNSPING or Microsoft Data Link to connect, it works fine.

I tried tinkering with the permissions on my Oracle directory, but that didn't seem to help.

Answer Source

Make sure you have installed the Oracle Database client (x86 or x64).

Make sure you have the PATH configured to use the Oracle bin folder:


Make sure your tnsnames.ora file is in the directory:


You can try and use the following connection string:

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=;User ID=myusername;Password=mypassword;


I don't have this environment variable (cause I use the extended connection string) but someone here and here suggest to add TNS_ADMIN.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download