I had been happily using my application locally for some time, but it was time to deploy it for user testing, and we know how things go wrong when that happened. After publishing my MVC application, I starting getting this error:
ORA-12154: TNS:could not resolve the connect identifier specified
Research suggested a connection string problem. In my web.config, I had a connection string similar to this:
<add name="ConnString" connectionString="DATA SOURCE=ScottDb;PASSWORD=blah;USER ID=scott" />
What I needed to do was configure it to look like an entry in the tnsnames.ora file, like so:
<add name="ConnString" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=Some-Host)(PORT=6000))(CONNECT_DATA=(SERVICE_NAME=scottprod.scott.com)));User Id=scott;Password=blah;" />
If your not sure where your tnsnames.ora file is located, you can try using the tnsping command to locate it. When I ran the command “tnsping ScottDb”, the file location and connection string was returned, so that may help you.