JG Vimalan's Blog

It is all about coding!

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

I got this error in my development system when I am trying to connect a oracle 10g database via my WCF serivce developed in .NET 4.0 framework.

The wcf service was running in IIS 7.5 and using the DefautAppPool. My suspect was the oracle client installed in my system. I could see that, I had different instances of Oracle 11g client in my system. So, I thaught of identifying the active one.

Inorder to find that, I opened the command prompt and typed tnsping <oracle database name>. Now, I was able to see the active oracle instance in my system as shown below,

In my case, it is client_2. Apart from this, I had client_1 and client_4 installed in my system.

As a next step, I verified the registry and found that, different instances of oracle exists as shown below,

Now, I modified the ‘Oracle Home’ for all instances to point to the correct location (in my case, it is client_2). See below,

I then recycled the application pool.

Tried to connect the oracle database via code and it worked!


April 26, 2012 Posted by | C#.NET, Oracle | 5 Comments

Cannot have two operations in the same contract with the same name, methods…

I was trying to do method overloading in my WCF 4.0 service and the code complied well but, while trying to open the service in test client, it throwed an error,

Cannot have two operations in the same contract with the same name, methods…

The code is as follows,

To fix this issue, I added “Name” attribute in the OperationContract as shown below,

This fixed the issue. And, while viewing the service in test client, observed that, the method name is exposed as  “GetFullNameByID” as shown below,

April 19, 2012 Posted by | WCF | Leave a comment