简体   繁体   English

应用程序池回收时与Oracle数据库的C#连接超时

[英]C# Connection timeout to oracle database when application pool recycles

We have a web page which uses ODP.Net to connect to oracle database from ASP MVC page. 我们有一个网页,该网页使用ODP.Net从ASP MVC页面连接到oracle数据库。 During the heavy user load if application pool recycles for any reason, than we get few connection timeout errors from internal oracle class. 在繁重的用户负载期间,如果由于任何原因导致应用程序池回收,那么从内部oracle类获得的连接超时错误将很少。

Inner Exception: StackTrace: at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch) 内部异常:StackTrace:在OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd,布尔bGetForApp,字符串finityInstanceInstanceName,布尔bForceMatch)

How can we handle this scenario ? 我们如何处理这种情况? what could be the reason for this error ? 该错误的原因可能是什么?

If you are using a new connection string that differs per user or with some other variable parameter you can exceed your max connections. 如果您使用的新连接字符串因每个用户而异,或者使用其他可变参数,则可能会超出最大连接数。 Pooling only works if you use the exact same string. 仅当使用完全相同的字符串时,池才有效。 Under the covers your "close" is ignored and the connection manager keeps the connection open. 在幕后,您的“关闭”将被忽略,连接管理器将保持打开状态。 In SQL Server you can see a connection reset in the trace console every time an existing connection is reused. 在SQL Server中,每次重新使用现有连接时,都可以在跟踪控制台中看到连接重置。

Oracle probably has something similar. Oracle可能有类似的东西。

Tracing your connections and possibly connection resets will most likely shed some light on what is creating so many connections. 跟踪您的连接以及可能的连接重置很可能会为创建如此多的连接提供一些启示。

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

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