使用 Server.CreateObject(“ADODB.Connection”) 的经典 ASP 中的连接泄漏
我正在查看现有的经典 asp 应用程序。设置如下:
- db.asp:使用 Server.CreateObject("ADODB.Connection") 打开连接,然后调用 conn.open
- func.asp:具有帮助程序方法,使用 db.asp 索引中的 conn 对象执行查询
- 。 asp:构建查询并调用 func.asp 中的方法,
index.asp 和 func.asp 都包含 db.asp。 index.asp 包含 func.asp 没有调用 conn.close 的地方。
- 请求结束时连接会自动关闭或恢复吗?
- 当index.asp 包含func.asp 时,让index.asp 和func.asp 包含db.asp 有何含义?多个连接?
- 是否有任何计数器可以检查正在建立的连接数?
我已经使用过 sp_who2,但即使在不同的浏览器下运行,也只能看到该应用程序的 1 条记录。尝试在连接字符串中使用集成安全性和 SQL 帐户。
我查看了性能计数器,但数字从未改变。它们停留在 5. MSSQL$Instance:General Statistics\Logical Connections 和 MSSQL$Instance:General Statistics\User Connections。
我们看到生产中的应用程序有多达 47 个连接,但我无法在本地重现它。连接被列为睡眠状态,而不是执行状态。
在IIS 7.5下运行经典asp
I'm looking at an existing classic asp application. The setup is as follows:
- db.asp: opens a connection using Server.CreateObject("ADODB.Connection") and then calls conn.open
- func.asp: has helper methods to execute queries using the conn object from db.asp
- index.asp: builds queries and makes calls to methods in func.asp
both index.asp and func.asp include db.asp. index.asp includes func.asp No where is conn.close called.
- Will the connections automatically be closed or recovered when the request ends?
- What are the implications of having index.asp and func.asp include db.asp when index.asp includes func.asp? Multiple connections?
- Are there any counters to check the number of connections being made?
I've already used sp_who2 but only see 1 record for the application even when run under different browsers. tried this using both integrated security and a sql account in the connection string.
I looked in performance counters but the numbers never change. They stay at 5. MSSQL$Instance:General Statistics\Logical Connections and MSSQL$Instance:General Statistics\User connections.
We're seeing up to 47 connections from the app in production but I cannot reproduce it locally. The connections were listed as sleeping, not executing.
Running classic asp under IIS 7.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该确保每个连接和每个记录集都已关闭并取消引用。例子:
You should make sure that every connection and every recordset are closed and dereferenced. Example: