ODP.NET-Fehler in IIS: ORA-12357-Netzwerksitzung Ende der Datei

Ich versuche, eine MVC-App auf einem IIS-Server mit einer Verbindung zu einer Oracle-Datenbank bereitzustellen. Dazu habe ich die ODAC-Erweiterung für Visual Studio 2013 heruntergeladen und mithilfe von Nuget den neuesten verwalteten ODP.NET-Client in das Projekt installiert. Auf meinem Entwicklungscomputer ist auch ein Oracle-Client installiert (d. H. Ich kann SQL Developer auf meinem Entwicklungscomputer ausführen). In ODP.NET muss der Oracle-Client jedoch nicht auf dem Server installiert sein. Die App läuft auf meiner Dev-Box zwar einwandfrei, aber bei der Bereitstellung auf dem Server treten Fehler auf und es kann keine funktionierende Oracle-Verbindung hergestellt werden. Bisher kann ich keine nützlichen Informationen darüber finden, was die Fehler verursacht oder wie ich sie umgehen kann.

Umgebung Visual Studio 2013 Update 5 unter 64-Bit-Windows 7, Bereitstellung unter Windows Server 2008 IIS 7. I donichenn Sie über Administratorrechte für die IIS-Box verfügen, ist diese gesperrt. Der Serveradministrator bückt sich nach hinten, um so viel wie möglich zu helfen, aber er kennt Oracle nicht, und ich weiß gerade noch genug, um gefährlich zu sein. Die lokalen Oracle-Entwickler lassen Java auf Linux-Servern laufen, daher bin ich der seltsame .NET / Windows-Typ ohne interne Unterstützung. Oracle-Datenbank ist 11.2.0.3.0. Die Web-App befindet sich in einem 64-Bit-App-Pool.

WICHTIG: Der Oracle-Client istnich auf der IIS-Box installiert. Wir sind uns nicht sicher, ob ein separater Oracle-Client installiert werden muss. Meine Messwerte zeigen nicht an, aber ich könnte mich irren.

Was ich brauche Idealerweise ein Projekt, das auf einem beliebigen IIS-Server bereitgestellt und eine Verbindung zu meiner Oracle-Zieldatenbank hergestellt werden kann.ohn Oracle-Komponenten / -Clients müssen auf dem Server installiert sein. Ich möchte so eigenständig wie möglich sein, damit ich die Auswirkungen auf den Server minimieren und zu 100% für das Konfigurationsmanagement meiner App verantwortlich bin. Wenn ich nicht vollständig eigenständig sein kann, muss ich in der Lage sein, ein schriftliches Dokument mit wiederholbaren Schritten zu generieren, um einen neuen IIS-Server nach Belieben zu konfigurieren und bereitzustellen, mit minimalen Auswirkungen auf den Server und die Oracle-Administratoren. Entity Framework wärewirklich net aber nicht unbedingt erforderlich - meine "echte" App (dies ist nur eine Spitze zum Testen der Verbindung) verwendet derzeit OleDbDataReader-Objekte in Domänen-Repositorys und ich werde sie in OracleDataReader austauschen, sobald die ODP.NET-Verbindung ordnungsgemäß funktioniert.

Spekulation Zur Zeit überlege ich mir folgende Ursachen für die unten genannten Fehler. Aber ich weiß nicht, was die eigentliche Ursache ist, also weiß ich nicht, wo ich mich konzentrieren soll.

ei @Server müssen Komponenten installiert sein. Wenn ja, welche

Server wird von der Firewall blockiert oder vom Datenbankserver nicht in die Whitelist aufgenommen. Die Firewall sollte für den Serveradministrator kein Problem darstellen, da die Whitelist der Datenbank nicht eindeutig ist.

?? Etwas anderes ?

Below ist eine Zusammenfassung dessen, was ich habe und was ich bekomme. Auf jede Aktion folgt die von ihr erzeugte Fehlermeldung.

Jeder davon läuft perfekt auf meiner Dev-Box - die Fehler sind alle auf dem Server.

/ Home / Index

Dies ist praktisch ein Kopieren / Einfügen vondieses Oracle-Tutorial:

public ActionResult Index()
{
    string conString = "User Id=myuserid;Password=mypassword;" +
        "Data Source=mydomain.foo:1521/myservicename; Pooling=false;";

    OracleConnection con = new OracleConnection();
    con.ConnectionString = conString;
    con.Open();

    return Content("OK");
}

Error Message: ORA-12537: Netzwerksitzung: Dateiende

ORA-12537: Network Session: End of file
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: OracleInternal.Network.NetworkException: ORA-12537: Network Session: End of file

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NetworkException (0x30f9): ORA-12537: Network Session: End of file]
   OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len) +294
   OracleInternal.Network.ReaderStream.ReadwithCrypto(OraBuf OB) +127

[NetworkException (0x80004005): ORA-12570: Network Session: Unexpected packet read error]
   OracleInternal.Network.ReaderStream.ReadwithCrypto(OraBuf OB) +1188
   OracleInternal.Network.ReaderStream.Read(OraBuf OB) +88
   OracleInternal.TTC.OraBufReader.GetDataFromNetwork() +274
   OracleInternal.TTC.OraBufReader.Read(Boolean bIgnoreData) +46
   OracleInternal.TTC.MarshallingEngine.UnmarshalUB1(Boolean bIgnoreData) +16
   OracleInternal.TTC.TTCProtocolNegotiation.ReadResponse() +86

[OracleException (0x80004005): ORA-12570: Network Session: Unexpected packet read error]
   OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +5643
   OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +1381
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword) +1583
   Oracle.ManagedDataAccess.Client.OracleConnection.Open() +3837
   OracleClientSpikeMvc.Controllers.HomeController.Oracle() +65
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

/ Home / Oracle

public ActionResult Oracle()
{
    var connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myservicename)));User Id=myuserid;Password=mypassword;";
    var conn = new OracleConnection(connectionString);
    conn.Open();

    var command = conn.CreateCommand();
    command.CommandText = "select sysdate from dual";
    command.CommandType = System.Data.CommandType.Text;
    var reader = command.ExecuteReader();

    if (!reader.HasRows)
        return Content("No rows returned");

    reader.Read();

    return Content(reader["sysdate"].ToString());
}

Error Message: ORA-12537: Netzwerksitzung: Dateiende

ORA-12537: Network Session: End of file
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: OracleInternal.Network.NetworkException: ORA-12537: Network Session: End of file

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NetworkException (0x30f9): ORA-12537: Network Session: End of file]
   OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len) +294
   OracleInternal.Network.ReaderStream.ReadwithCrypto(OraBuf OB) +127

[NetworkException (0x80004005): ORA-12570: Network Session: Unexpected packet read error]
   OracleInternal.Network.ReaderStream.ReadwithCrypto(OraBuf OB) +1188
   OracleInternal.Network.ReaderStream.Read(OraBuf OB) +88
   OracleInternal.TTC.OraBufReader.GetDataFromNetwork() +274
   OracleInternal.TTC.OraBufReader.Read(Boolean bIgnoreData) +46
   OracleInternal.TTC.MarshallingEngine.UnmarshalUB1(Boolean bIgnoreData) +16
   OracleInternal.TTC.TTCProtocolNegotiation.ReadResponse() +86

[OracleException (0x80004005): ORA-12570: Network Session: Unexpected packet read error]
   OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +5643
   OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +1381
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword) +1583
   Oracle.ManagedDataAccess.Client.OracleConnection.Open() +3837
   OracleClientSpikeMvc.Controllers.HomeController.Oracle() +65
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

/ Home / EntityFrameworkTest

Dies verwendet einen EF Code-first-Kontext, der aus der Datenbank generiert wurde:

public ActionResult EntityFrameworkTest()
{
    using (var ctx = new MyContext())
    {
        var list = ctx.MyModel.OrderBy(m => m.MyField).ToList();
        return View(list);
    }
}

Error Message: Zeitüberschreitung der Verbindungsanforderung

Connection request timed out
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Oracle.ManagedDataAccess.Client.OracleException: Connection request timed out

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[OracleException (0x80004005): Connection request timed out]
   OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +5643
   OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) +1381
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword) +1583
   Oracle.ManagedDataAccess.Client.OracleConnection.Open() +3837
   Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices.GetDbProviderManifestToken(DbConnection connection) +234
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +118

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +459
   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +40

[ProviderIncompatibleException: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.]
   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +126
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +83
   System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +327
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +118
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +94
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +248
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +543
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +26
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +72
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +64
   System.Linq.Queryable.OrderBy(IQueryable`1 source, Expression`1 keySelector) +85
   OracleClientSpikeMvc.Controllers.HomeController.Index() +282
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Web.config extrahiert

<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>

<connectionStrings>
    <add name="MyContext" connectionString="DATA SOURCE=mydatasource;PASSWORD=mypassword;USER ID=myuserid" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>

<dependentAssembly>
    <publisherPolicy apply="no" />
    <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
</dependentAssembly>

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
        <parameters>
        <parameter value="mssqllocaldb" />
        </parameters>
    </defaultConnectionFactory>
    <providers>
        <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
</entityFramework>

<system.data>
    <DbProviderFactories>
        <remove invariant="Oracle.ManagedDataAccess.Client" />
        <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
</system.data>

Was müssen wir tun, um diese Fehler zu beseitigen und vom Server aus eine Verbindung zur Oracle-Datenbank herzustellen? Jede Hilfe wird sehr geschätzt, danke!

Antworten auf die Frage(0)

Ihre Antwort auf die Frage