asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

Last post 07-16-2008 2:36 AM by Michal Gorski. 30 replies.

Sort Posts:

  • asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    02-07-2007, 5:54 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

     

     

    I created webapp on one server to query an oracle database housed on another server

    It works from within visual studio,”view in browser” but when the page is server from IIS the following is displayed

     

    System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified

     

    Any help is much appreciated; Crying

    full details of the setup are below, is this a permissions issue.

    I have read many many posts and believe that I have everything configured correctly ?

     

     

    SERVERone:

    Windows 2003 server running IIS 6.0 with .NET framework 2.057 and oracle InstantClient.

    Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

                            I have a tnsname.ora and sqlnet.ora saved to the same directory (C:\instantClient\instantclient10_1)

    I have a corresponding enviroment variable to that folder TNS_ADMIN C:\instantClient\instantclient10_1

    “Authenticated Users” has FULL CONTROL  permissions on this folder and subfolders

    Permission for read execute are also set for IWAM_SERVERone , IUSR_SERVERone, SERVERtwo/ASPNET

     

     

    SERVEtwo:

    Windows 2003 sever which is running an instance of Oracle 9i database.in

    ORA home folder “Authenticated Users” has FULL CONTROL permissions and sub folders

    Permission for read execute are also set for IWAM_SERVERone, IUSR_SDMS-SERVERone, SERVERtwo ASPNET

     

    I can successfully connect from SERVERone to SERVERtwo using TOAD 9.0.1 and I can query the database.

     

    More Details.....

    I want to create a web app on SERVERone to queryan oracle database on SERVERtow

    I created an ASP.NET application using visual web developer.

    I addded a sqldatasource and configured the sqldatasource to use “oracle database” as the data source, and the data provider.NET Framework Data Provider for Oracle

    I set the Server Name to the entry from the Tnanames.ora file an dentered the username and password

    When I click TEST CONNECTION it works , I then added a select * from xyz query

     

    WHEN I RUN THE PAGE FROM WITHIN VWD it works perfectly ( “view in browser”)

     

    However when I add the site to IIS and launch the page I get the ORA-12154 error

     

    TNSNAME.ORA entry

     

    HOMER=

      (DESCRIPTION =

        (ADDRESS_LIST =

            (ADDRESS =

              (PROTOCOL = TCP)

              (HOST = 182.198.100.14)

              (PORT = 1521)

            )

        )

        (CONNECT_DATA =

           (SID = ERR)

           (GLOBAL_NAME = ERR.world)

        )

      )

     

    sqlnet.ora ( this is the only line in this file , I also tried NTFS to no avail)

     

    SQLNET.AUTHENTICATION_SERVICES= (NONE)

     

    DATA SOURCE

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT * FROM XYZ'>

                <SelectParameters>

     

     WEB CONFIG Entry

    <

    ORA-12154: TNS:could not resolve the connect identifier specified

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified


    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

     
    [OracleException (0x80131938): ORA-12154: TNS:could not resolve the connect identifier specified
    ]
       System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc) +84
       System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +688
       System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +135
       System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +37
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +429
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +70
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +512
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +102
       System.Data.OracleClient.OracleConnection.Open() +34
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +41
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

     


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

    AiDo
    Filed under: , ,
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    02-08-2007, 1:13 AM
    • Loading...
    • ramana123
    • Joined on 06-27-2005, 12:02 PM
    • Bangalore
    • Posts 224

    Hi

    did you give permissions to the ASP.NET users for ORacle home folder and subfolders too[Check this at subfolders level whether the permissions were set or not]

    Cheers
    Ram MCP
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-01-2007, 6:04 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

    Hi

    Thanks for the reply.  My Oracle Hoem folder ( c:/instanClient/) has permissions for "ASP.NET Machine Account " for all sub folders

     Thsi is really bugging me now , can anyone help?

    Aidan 

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-02-2007, 2:13 AM
    • Loading...
    • hivani
    • Joined on 11-14-2006, 2:31 AM
    • india, hydrabad
    • Posts 55

    me too getting the same error if got the solution  please inform  to me

    my address:

    A . Shiva Prasad

    GIS Developer

    MIDWESTINFOTECH Pvt LIMITED

    70 , Kanakapura main road , JP Nagar 6th Phase

    Opposite to family mart  Bangalore

    INDIA

    @mail : shiva.prasad@midwestinfotech.com , altrenate mail is : asp.347@gmail.com

    mobile : +919886451711

     

     

    Shiv
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-02-2007, 4:05 AM
    • Loading...
    • ramana123
    • Joined on 06-27-2005, 12:02 PM
    • Bangalore
    • Posts 224

    Hi,

    If you are using asp.net2.0 then processmodel attribute in machine.config file values set to "system".Other than this no guessses...

    if this also not sort out your problem means you should reinstall the s/w.

    Cheers
    Ram MCP
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-02-2007, 6:31 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

    HI

    Thanks Ramana123,

    It seems to be system alreday.

    <section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" allowLocation="false" /> 

     

    The bosses are now trying to get rid of  asp.net for this application and use pl/sql.

    I really want to use asp.net , ANY HELP IS MUCH APPRECIATED GUYS 

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-02-2007, 6:44 AM
    • Loading...
    • ramana123
    • Joined on 06-27-2005, 12:02 PM
    • Bangalore
    • Posts 224

    Hi,

    It seems your machine.config doesnt have the attribute username= 'system' try with after adding best of luck..

     

    Cheers
    Ram MCP
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-02-2007, 9:22 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

    Thanks again for teh reply RAM.

     When I add username='system or userName='system' or userName="system"

    I get the teh parser error message below  , Any thoughts, have I mispelled it ?

    Thank you again
    Parser Error Message: Unrecognized attribute 'userName'. Note that attribute names are case-sensitive.

    Machine.config entry... 

    <section name="processModel" userName="system" type="System.Web.Configuration.ProcessModelSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" allowLocation="false"/>
               
     

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-04-2007, 10:49 PM
    • Loading...
    • ramana123
    • Joined on 06-27-2005, 12:02 PM
    • Bangalore
    • Posts 224

    Hi,

    in asp.net2.0 after enteruing into that section in machine.config then press "psace bar" so that the intelligence window will open for to avoid the spelling mistakes.

    But I think there will be two process model sections are available in 2.0.please check it and add since I dont have 2.0 in my pc at this moment I unable to figure it which section ecatly it is.

    Cheers
    Ram MCP
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-05-2007, 5:16 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

    Hi

    Thanks again for your help Ram,
    I found the second sectioin in the machien.config under <system.web>
    I added the userName attribute using the intellisense as suggested. I set teh userName property to system.

    Unfortunatley it did not resolve the TNS error I'm recieving. The section in my machien.config is as follows

     <system.web>
            <processModel userName="system" autoConfig="false"/>

    I also tried

     <system.web>
            <processModel userName="system" autoConfig="true"/>

     

     I am now at a complete loss as to what the problem is?

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-14-2007, 2:47 PM

    Hi,

     

    Was anyone able to find the the solution to the above problem??

    I am stuck here too and cant figure out what's the issue.

     

    Please help

     

    Thanks,

    Filed under: ,
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    03-16-2007, 11:44 AM
    • Loading...
    • aidoco
    • Joined on 06-05-2006, 9:40 PM
    • Posts 84

    Hi

    I'm still completely baffled by this.

    I worked around it by installing .net and iis on the "data Server" and use it as teh web server in order to serve the data from my asp.net page, so essentaill both web and data are on the same server and it works . THIS MAY HELP YOU

    It some env variable but i can't figure out what .

    Please get in touch if you can fix this annoying issue

    Thanks 

     

     

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-04-2007, 6:31 AM