简体   繁体   English

ODP.NET IIS 7.5 WEB API错误

[英]ODP.NET IIS 7.5 WEB API error

I have just migrated my ASP.NET 4.0 C# website from IIS 6 to IIS 7.5 I installed via nuget Oracle Managed and ODP.NET Managed packages to my project. 我刚刚将我的ASP.NET 4.0 C#网站从IIS 6迁移到了通过nuget Oracle Managed和ODP.NET Managed软件包安装到我的项目的IIS 7.5。 I'm having this error when trying to access my ASP.NET WEB API. 尝试访问ASP.NET WEB API时出现此错误。 How do I troubleshoot this? 我该如何解决? Thanks 谢谢

<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'.
</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace/>
<InnerException>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Exception has been thrown by the target of an invocation.
</ExceptionMessage>
<ExceptionType>System.Reflection.TargetInvocationException</ExceptionType>
<StackTrace>
at System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) at System.Reflection.RtFieldInfo.InternalGetValue(Object obj, Boolean doVisibilityCheck, Boolean doCheckConsistency) at System.Reflection.RtFieldInfo.GetValue(Object obj) at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() at WriteArrayOfADDRESSTYPEToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract ) at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context) at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle) at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType) at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType) at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) at System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter writer, Object graph) at System.Net.Http.Formatting.XmlMediaTypeFormatter.<>c__DisplayClass7.<WriteToStreamAsync>b__6() at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
</StackTrace>
<InnerException>
<Message>An error has occurred.</Message>
<ExceptionMessage>
The type initializer for 'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.
</ExceptionMessage>
<ExceptionType>System.TypeInitializationException</ExceptionType>
<StackTrace/>
<InnerException>
<Message>An error has occurred.</Message>
<ExceptionMessage>
The provider is not compatible with the version of Oracle client
</ExceptionMessage>
<ExceptionType>Oracle.DataAccess.Client.OracleException</ExceptionType>
<StackTrace>
at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleClientFactory..cctor()
</StackTrace>
</InnerException>
</InnerException>
</InnerException>
</Error>

与问题陈述相反,似乎该应用程序使用的是非托管客户端(名称空间Oracle.DataAccess.Client )而不是托管客户端(名称空间Oracle.ManagedDataAccess.Client ),并且它与计算机上安装的Oracle Client不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM