0

I connected my C# MVC API to Oracle, however when I ran the API and tested it I got the error below. I checked .NET references and Oracle.Data.Access is installed, in addition I removed it and reinstalled Oracle.Data.Access but the same error persists. What might this be?

 {
 "Message": "An error has occurred.",
 "ExceptionMessage": "ORA-12170: TNS:Connect timeout occurred",
 "ExceptionType": "Oracle.DataAccess.Client.OracleException",
 "StackTrace": "   at         Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)\r\n   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)\r\n   at Oracle.DataAccess.Client.OracleConnection.Open()\r\n   at MRF_API.Controllers.ItemController.Get(String searchdesc) in C:\\Users\\nevinj\\Documents\\Visual Studio 2015\\Projects\\MRF_API\\MRF_API\\Controllers\\ItemController.cs:line 88\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
  }

1 Answer 1

1

The actual issue you have to analyze at this point is ORA-12170: TNS:Connect timeout occurred.

You will find online that are plenty of reasons why this error might be triggered but possibly the first thing for you to check is making sure that your connection string / TNS entry is set up properly.

Attempt to use the same connection string from the same machine but another client (e.g. sqlplus) and see if that works (to confirm that the database is up and reachable from the client computer).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for replying. I will follow up your suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.