469,926 Members | 2,027 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

ORA-12154: TNS:could not resolve service name -- WebServices

I just installed ODP.net 10.2.02 on my local machine (Windows XP Pro)
running IIS.

I have created a sample webservice in VS2003, connecting to localhost.
I am getting:
Oracle.DataAccess.Client.OracleException ORA-12154: TNS:could not
resolve the connect identifier specified at
Oracle.DataAccess.Client.OracleException.HandleErr orHelper(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx*
pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleErr or(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Oracle.DataAccess.Client.OracleConnection.Open()
at MikesWebservice.Service1.GetNumberOfLogons() in
c:\inetpub\wwwroot\webservices\MikesWebservice\Ser vice1.asmx.vb:line 69

1- I am using tnsnames.ora file that is in the install path for
ODP.net: C:\oracle\product\10.2.0\client_1\network\ADMIN

2- My SQLNET.ora contents:
TRACE_LEVEL_CLIENT = OFF
#sqlnet.authentication_services = (NONE)
names.directory_path = (TNSNAMES, HOSTNAME)
#names.default_domain = world
name.default_zone = world
automatic_ipc = off

3- My TNSNames.ora file as needed for my connection:
NPD1.world=(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(COMMUNITY =
TCP.world)(PROTOCOL = TCP)(Host = neolynx.neopostinc.com)(PORT =
1521)))(CONNECT_DATA=(SID=NPD1)(SERVER=DEDICATED)) )

4- My Code related to the Connection open:
Dim connectionString As String = "User Id=webmgr;Password=hayward1;Data
Source=npd1.world"
Dim oraCon As OracleConnection
Dim returnNumber As Double
oraCon = New OracleConnection
oraCon.ConnectionString = connectionString
oraCon.Open()

Dim oraCmd As OracleCommand
oraCmd = oraCon.CreateCommand()
oraCmd.CommandText = "select count(*) from
nweb_customer_logons;"
Dim oraReader As OracleDataReader
oraReader = oraCmd.ExecuteReader()
While (oraReader.Read)
returnNumber = oraReader.GetDouble(0)
End While
oraReader.Dispose()
oraCmd.Dispose()
oraCon.Dispose()

I can use TNSPing from the \bin\ directory under the OPD.net install. I
have verified there are no paranthesis in any of the folder paths, and
have verified that Authenticated Users, and the ASP_NET user have
access to those folders.

I have no clue where to go from here. Thanks for any insight.

Aug 15 '06 #1
5 16919
Sorry.. Was searching the net for the error message, and found this
group. My code is vb.net, not c#. Hope that doesn't make a difference
in you guys helping me. :)

Aug 15 '06 #2
This is most likely an issue with running the webservice under the local
ASPNET account. You will probably want to look at impersonating a user with
the appropriate credentials to connect to the database.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<js********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>I just installed ODP.net 10.2.02 on my local machine (Windows XP Pro)
running IIS.

I have created a sample webservice in VS2003, connecting to localhost.
I am getting:
Oracle.DataAccess.Client.OracleException ORA-12154: TNS:could not
resolve the connect identifier specified at
Oracle.DataAccess.Client.OracleException.HandleErr orHelper(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx*
pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleErr or(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Oracle.DataAccess.Client.OracleConnection.Open()
at MikesWebservice.Service1.GetNumberOfLogons() in
c:\inetpub\wwwroot\webservices\MikesWebservice\Ser vice1.asmx.vb:line 69

1- I am using tnsnames.ora file that is in the install path for
ODP.net: C:\oracle\product\10.2.0\client_1\network\ADMIN

2- My SQLNET.ora contents:
TRACE_LEVEL_CLIENT = OFF
#sqlnet.authentication_services = (NONE)
names.directory_path = (TNSNAMES, HOSTNAME)
#names.default_domain = world
name.default_zone = world
automatic_ipc = off

3- My TNSNames.ora file as needed for my connection:
NPD1.world=(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(COMMUNITY =
TCP.world)(PROTOCOL = TCP)(Host = neolynx.neopostinc.com)(PORT =
1521)))(CONNECT_DATA=(SID=NPD1)(SERVER=DEDICATED)) )

4- My Code related to the Connection open:
Dim connectionString As String = "User Id=webmgr;Password=hayward1;Data
Source=npd1.world"
Dim oraCon As OracleConnection
Dim returnNumber As Double
oraCon = New OracleConnection
oraCon.ConnectionString = connectionString
oraCon.Open()

Dim oraCmd As OracleCommand
oraCmd = oraCon.CreateCommand()
oraCmd.CommandText = "select count(*) from
nweb_customer_logons;"
Dim oraReader As OracleDataReader
oraReader = oraCmd.ExecuteReader()
While (oraReader.Read)
returnNumber = oraReader.GetDouble(0)
End While
oraReader.Dispose()
oraCmd.Dispose()
oraCon.Dispose()

I can use TNSPing from the \bin\ directory under the OPD.net install. I
have verified there are no paranthesis in any of the folder paths, and
have verified that Authenticated Users, and the ASP_NET user have
access to those folders.

I have no clue where to go from here. Thanks for any insight.

Aug 15 '06 #3
Hello Nicholas Paldino [.NET/C# MVP],

or probably with NetworkSystem account that need to have appropriate access
to see oracle folder

NThis is most likely an issue with running the webservice under
Nthe local ASPNET account. You will probably want to look at
Nimpersonating a user with the appropriate credentials to connect to
Nthe database.
N>
N<js********@gmail.comwrote in message
Nnews:11**********************@b28g2000cwb.googleg roups.com...
N>
>I just installed ODP.net 10.2.02 on my local machine (Windows XP Pro)
running IIS.

I have created a sample webservice in VS2003, connecting to
localhost.
I am getting:
Oracle.DataAccess.Client.OracleException ORA-12154: TNS:could not
resolve the connect identifier specified at
Oracle.DataAccess.Client.OracleException.HandleEr rorHelper(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx*
pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleErr or(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Oracle.DataAccess.Client.OracleConnection.Open()
at MikesWebservice.Service1.GetNumberOfLogons() in
c:\inetpub\wwwroot\webservices\MikesWebservice\Se rvice1.asmx.vb:line
69
1- I am using tnsnames.ora file that is in the install path for
ODP.net: C:\oracle\product\10.2.0\client_1\network\ADMIN

2- My SQLNET.ora contents:
TRACE_LEVEL_CLIENT = OFF
#sqlnet.authentication_services = (NONE)
names.directory_path = (TNSNAMES, HOSTNAME)
#names.default_domain = world
name.default_zone = world
automatic_ipc = off
3- My TNSNames.ora file as needed for my connection:
NPD1.world=(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(COMMUNITY =
TCP.world)(PROTOCOL = TCP)(Host = neolynx.neopostinc.com)(PORT =
1521)))(CONNECT_DATA=(SID=NPD1)(SERVER=DEDICATED) ))

4- My Code related to the Connection open:
Dim connectionString As String = "User
Id=webmgr;Password=hayward1;Data
Source=npd1.world"
Dim oraCon As OracleConnection
Dim returnNumber As Double
oraCon = New OracleConnection
oraCon.ConnectionString = connectionString
oraCon.Open()
Dim oraCmd As OracleCommand
oraCmd = oraCon.CreateCommand()
oraCmd.CommandText = "select count(*) from
nweb_customer_logons;"
Dim oraReader As OracleDataReader
oraReader = oraCmd.ExecuteReader()
While (oraReader.Read)
returnNumber = oraReader.GetDouble(0)
End While
oraReader.Dispose()
oraCmd.Dispose()
oraCon.Dispose()
I can use TNSPing from the \bin\ directory under the OPD.net install.
I have verified there are no paranthesis in any of the folder paths,
and have verified that Authenticated Users, and the ASP_NET user have
access to those folders.

I have no clue where to go from here. Thanks for any insight.
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #4
I have added permissions for the Network Service account, without luck.
It still doesn't work.

Any other ideas?

Aug 15 '06 #5
Hello js********@gmail.com,

grand full righst to the asp.net account or impersonate it as Nicholas suggested
I have added permissions for the Network Service account, without
luck. It still doesn't work.

Any other ideas?
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ashish Namdeo | last post: by
1 post views Thread by Doron | last post: by
reply views Thread by J.Bijleveld | last post: by
2 posts views Thread by J.Bijleveld | last post: by
reply views Thread by s.kapitza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.