Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Silverlight WCF RIA service returns ORA-12154 after published to web server

Posted on 2011-10-24
13
Medium Priority
?
737 Views
Last Modified: 2012-08-14
Hello,

Using the Silverlight Business Application template I was able to develop a Silverlight 4 web application which connects to an Oracle DB located on a remote server.  Running it while in the Visual Studio 2010 it executed fine and loaded the DataGrid with the expected data.  I then published it to IIS 7 running on the same server that I developed it on.  User Authentication worked fine.  When I browsed to the page where the DataGrid is located I got a ORA-12154 TNS could not resolve the connect identifier specified.

It seemed like that it might be an issue with accessing the TNSNAMES.ORA file on the remote server.  So I copied down the TNSNAMES.ORA and SQLNET.ORA files from the remote server to a local directory on my development server and changed the TNS_ADMIN environment variable to point to the local directory, granted read access to "Everyone" and restarted the World Wide Web service  and still get the same results as before (can access from VS 2010 but not from the installed website; all on the same server).

The following is the configuration

Webserver: Windows 2008 Server R2
                  IIS 7
Oracle client:
                  Oracle 10.2.0 client installed first with
                  ODAC1120250Beta_EntityFramework_32bit installed into a different oracle home
                  with C:\app\[uid]\product\11.2.0\client_2;C:\app\[uid]\product\11.2.0\client_2\bin;
                  added to the PATH environment variable ahead of C:\oracle\product\10.2.0\client_1\bin
Silverlight 4
Visual Studio 2010
WCF RIA service pack 1
Windows Authentication enabled

partial web.config


Help is greatly appreciated
from web.config: substitued values that may be sensitive data is surrounded by square brackets

  <configSections>
    <sectionGroup name="system.serviceModel">
      <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=[token]" allowDefinition="MachineToApplication" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
    <add name="CEntities" connectionString="metadata=res://*/CEDM.csdl|res://*/C.ssdl|res://*/CEDM.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=[dbName];PASSWORD=[pwd];PERSIST SECURITY INFO=True;USER ID=[uid]&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

 
   <authentication mode="Windows">
      <!--<forms name=".Corpmenu_ASPXAUTH" timeout="2880" />-->
    </authentication>

    <membership defaultProvider="AspNetADMembershipProvider">
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
        <add name="AspNetADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>

    <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

    <profile enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
      <properties>
        <add name="FriendlyName" />
      </properties>
    </profile>

Open in new window

0
Comment
Question by:modotx
  • 7
  • 6
13 Comments
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37024062
I only know enough .Net to be dangerous but since no other Expert posted, I'll try to help you.

Just for grins grant Read and Execute on all parent folders recursive down to the tnsnames.ora file to the ASPNET user.

Just to confirm:  The only difference between working and not working was the publish?  The machine stayed the same?
0
 

Author Comment

by:modotx
ID: 37024379
Yes, the machine stayed the same.

There seems to be a potential problem with that.  The folder was already at the root directory.  So I thought, why not create a share and grant access to that, Of course that did not work.  If I try to grant everyone read access to the root everything that inherits from the root will have read access.  This is very baffling.  I have tried enabling and disabling Impersonation, no dice.
0
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 37024538
As a test let's eliminate the TNS_ADMIN variable.

Take the good tnsnames.ora and sqlnet.ora files and copy them to both HOME folders (backup the files already there):

C:\app\[uid]\product\11.2.0\client_2;C:\app\[uid]\product\11.2.0\client_2\network\admin
C:\oracle\product\10.2.0\client_1\network\admin


Let's at least see if we can change the error message.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:modotx
ID: 37024950
Ok, I have also done something else.  I created a separate app pool to run the app in and used my user id as the user for the app pool to run under.  I then put the connection info into the connection string in the web.config file and viola it works perfectly.  I then switched back to the Default App Pool and it still worked fine.  So I now know there is not a problem with accessing the client.  

I will let you know what I find with your last suggestion.
0
 

Author Comment

by:modotx
ID: 37025208
Doing what you suggested worked.  Now, should I remove them from one of the Oracle homes?
0
 

Author Comment

by:modotx
ID: 37025325
A question I have is - is there something in the active home directory that I need to configure so that it will look at the ORA files outside of that oracle home's network admin directory?
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37025327
>>Now, should I remove them from one of the Oracle homes?

I wouldn't.  I keep copies in ALL my homes for this very reason.

I'm more concerned why TNS_ADMIN wasn't picked up on.  Oracle changes/tweaks that variable with every release.  The last time I used it it was set under the Environment variables for the system.

I think I've seen/read some posts where it can also be set in the registry.  I would have no idea exactly where.
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37025332
>>is there something in the active home directory that I need to configure

You caught me typing.  TNS_ADMIN is 'supposed' to be that way.
0
 

Author Comment

by:modotx
ID: 37025599
Yeah TNS_ADMIN is supposed to be that way but for some reason it isn't.  So I was just wondering if something else needed to be set or configured is all.  I wonder if there is a way to see what the Default App Pool env looks like as it is running?  I know I am grasping at straws, but could it be that for some reason the TNS_ADMIN environment variable is not being picked up/set in the process that the Default App Pool is running in?
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37025734
Nuts and bolts of IIS are way above my head.  I can barely stop and start app pools using the GUI.

It's possible that with the new out of the box security IIS doesn't get a 'real' environment to run in.

Did you try the registry?  I would probably start under the root of HKEY_LOCAL_MACHINE\Software\Oracle

http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/config_concepts.htm#NETAG187

On Microsoft Windows, the TNS_ADMIN environment variable is used if it is set in the environment of the process. If the TNS_ADMIN environment variable is not defined in the environment, or the process is a service which does not have an environment, then Microsoft Windows scans the registry for a TNS_ADMIN parameter.
0
 

Author Comment

by:modotx
ID: 37027230
My apologies for not responding earlier.  I'll look into the registry as soon as I get this app I am working on touched up so the user can see it.  It may not be until tomorrow.
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37027246
No problem.  I'm here till the very end!

I almost want to install silverlight and try to reproduce this for you...  almost.

I have a hard enough time with basic .Net code (Oracle DBA by trade).
0
 

Author Closing Comment

by:modotx
ID: 37051510
Ok, it looks like the current solution is to place the tnsnames.ora file in the home I want to use.  There just seems to be with something about the environment which is preventing the web environment to access the remote tns_name.ora file.  At least we are able to acces the DB now :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question