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.
Using TNS:
(For ASP.NET Core you need the TNS_ADMIN environment variable pointing to the directory where tnsnames.ora is located)
Data Source = TORCL; User Id = myUsername; Password = myPassword;
Not using TNS:
Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = MyHost) (PORT = MyPort))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MyOracleSID));
User Id = myUsername; Password = myPassword;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With