locked
Server Error in '/' Application. ORA-12154: TNS ... RRS feed

  • Question

  • User991566988 posted

    Hi All,

    I've Oracle DB 11g connected to Visual Studio 2013 Ultimate using ODP.NET managed driver Data Source.

    The connection is succeeded and I've created a model using Entity Framework depending on that connection and then a controller for one table depending on the entity which creates 6 views

    When I run any of them it gives me this error (Except Create view because it doesn't bring any data):

    Server Error in '/' Application

    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: OracleInternal.Network.NetworkException: ORA-12154: TNS:could not resolve the connect identifier specified

     

    Note: I put the connect identifier in the TNSNAMES of ODT folder: <path>\Oracle Developer Tools for VS2013\network\admin

    How to solve?

    Sunday, December 27, 2015 8:47 AM

All replies

  • User269602965 posted

    When you read the Managed Driver documentation

    It gives you various options on where to place the TNSNAMES.ora and HOW to tell the application where the tnsnames is located.

    Also for entity framework there is additional steps and drivers required

    Monday, December 28, 2015 7:05 PM
  • User991566988 posted

    I did every thing and the connection at development time is succeeded and the controller is created depending on the mode!

    I copied the TNSNAMES file from the  Oracle Path to the ODT path but the error still!

    How can I solve it plz?

    Saturday, January 2, 2016 5:38 AM
  • User269602965 posted

    I put the TNSNAMES.ORA in the /BIN directory of my application.

    It will look there first.

    App.Config.

    <configuration>
      <configSections>
        <section name="oracle.manageddataaccess.client"
            type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
      </configSections>
      <connectionStrings>
        <add name="{APPNAME}.My.MySettings.OraConnStr" connectionString="User Id={SCHEMANAME};Password={SchemaPassword};Data Source={OracleInstanceName}" />
      </connectionStrings>
      <system.data>
        <DbProviderFactories>
          <remove invariant="Oracle.DataAccess.Client" />
          <remove invariant="Oracle.ManagedDataAccess.Client" />
          <add name="ODP.NET, Managed Driver" invariant="Oracle.DataAccess.Client"
               description="Oracle Data Provider for .NET, Managed Driver"
               type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </DbProviderFactories>
      </system.data>
      <oracle.manageddataaccess.client>
        <version number="*">
        </version>
      </oracle.manageddataaccess.client>
    etc.

    Saturday, January 2, 2016 8:24 PM