Problem
After creating a WCF Data Service using Devart data driver , it failed to connect to data base when deployed on production/test servers but works perfectly fine with localhost
Error Message and Stack Trace
- <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code />
<message xml:lang="en-US">An error occurred while processing this request.</message>
- <innererror>
<message>Exception has been thrown by the target of an invocation.</message>
<type>System.Reflection.TargetInvocationException</type>
<stacktrace>at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.Data.Services.RequestQueryProcessor.GenerateQueryResult() at System.Data.Services.RequestQueryProcessor.ProcessQuery() at System.Data.Services.RequestQueryProcessor.ProcessQuery(IDataService service, RequestDescription description) at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service) at System.Data.Services.DataService`1.HandleRequest()</stacktrace>
- <internalexception>
<message>The underlying provider failed on Open.</message>
<type>System.Data.EntityException</type>
<stacktrace>at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at System.Linq.Queryable.LongCount[TSource](IQueryable`1 source)</stacktrace>
- <internalexception>
<message>Unable to load C:\oracle\product\11.2.0\client_1\oci.dll. Please check that you use 64x version of Oracle client with 64x application.</message>
<type>Devart.Data.Oracle.OracleProviderException</type>
<stacktrace>at Devart.Data.Oracle.aw..ctor(Boolean A_0, Boolean A_1, OracleHome A_2) at Devart.Data.Oracle.aw.a(Boolean A_0, Boolean A_1, OracleHome A_2, Boolean A_3) at Devart.Data.Oracle.OracleInternalConnection..ctor(z connectionOptions, OracleInternalConnection proxyConnection) at Devart.Data.Oracle.cs.a(i A_0, Object A_1, DbConnectionBase A_2) at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, i A_1, DbConnectionBase A_2) at Devart.Common.DbConnectionPool.a(DbConnectionBase A_0) at Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection) at Devart.Common.DbConnectionFactory.a(DbConnectionBase A_0) at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) at Devart.Common.DbConnectionBase.Open() at Devart.Data.Oracle.OracleConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)</stacktrace>
- <internalexception>
<message>An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)</message>
<type>System.BadImageFormatException</type>
<stacktrace>at OciDynamicType.nativeOCIEnvCreate(IntPtr& , Int32 , IntPtr , IntPtr , IntPtr , IntPtr , UInt32 , UInt32 ) at Devart.Data.Oracle.aw..ctor(Boolean A_0, Boolean A_1, OracleHome A_2)</stacktrace>
</internalexception>
</internalexception>
</internalexception>
</innererror>
</error>
Root Cause
There could be three possible issues in case of such errors
Connection String Before
[TODO]
Connection String After
[TODO]
After creating a WCF Data Service using Devart data driver , it failed to connect to data base when deployed on production/test servers but works perfectly fine with localhost
Error Message and Stack Trace
- <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code />
<message xml:lang="en-US">An error occurred while processing this request.</message>
- <innererror>
<message>Exception has been thrown by the target of an invocation.</message>
<type>System.Reflection.TargetInvocationException</type>
<stacktrace>at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.Data.Services.RequestQueryProcessor.GenerateQueryResult() at System.Data.Services.RequestQueryProcessor.ProcessQuery() at System.Data.Services.RequestQueryProcessor.ProcessQuery(IDataService service, RequestDescription description) at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service) at System.Data.Services.DataService`1.HandleRequest()</stacktrace>
- <internalexception>
<message>The underlying provider failed on Open.</message>
<type>System.Data.EntityException</type>
<stacktrace>at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at System.Linq.Queryable.LongCount[TSource](IQueryable`1 source)</stacktrace>
- <internalexception>
<message>Unable to load C:\oracle\product\11.2.0\client_1\oci.dll. Please check that you use 64x version of Oracle client with 64x application.</message>
<type>Devart.Data.Oracle.OracleProviderException</type>
<stacktrace>at Devart.Data.Oracle.aw..ctor(Boolean A_0, Boolean A_1, OracleHome A_2) at Devart.Data.Oracle.aw.a(Boolean A_0, Boolean A_1, OracleHome A_2, Boolean A_3) at Devart.Data.Oracle.OracleInternalConnection..ctor(z connectionOptions, OracleInternalConnection proxyConnection) at Devart.Data.Oracle.cs.a(i A_0, Object A_1, DbConnectionBase A_2) at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, i A_1, DbConnectionBase A_2) at Devart.Common.DbConnectionPool.a(DbConnectionBase A_0) at Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection) at Devart.Common.DbConnectionFactory.a(DbConnectionBase A_0) at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) at Devart.Common.DbConnectionBase.Open() at Devart.Data.Oracle.OracleConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)</stacktrace>
- <internalexception>
<message>An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)</message>
<type>System.BadImageFormatException</type>
<stacktrace>at OciDynamicType.nativeOCIEnvCreate(IntPtr& , Int32 , IntPtr , IntPtr , IntPtr , IntPtr , UInt32 , UInt32 ) at Devart.Data.Oracle.aw..ctor(Boolean A_0, Boolean A_1, OracleHome A_2)</stacktrace>
</internalexception>
</internalexception>
</internalexception>
</innererror>
</error>
Root Cause
There could be three possible issues in case of such errors
- Conflict in binary version conflict in between Devart and database, In our case it was negative
- Devart is not able to locate correct oracle home.In our case it was negative
- Local host is using TNS bases connection string and the same TNS file is not available on server.This is most likely root cause
- For point 1-2 solution is self explanatory
- For 3 instead of TNS based connection string use full connection string with actual server name and port information.
Connection String Before
[TODO]
Connection String After
[TODO]
No comments:
Post a Comment