日期:2014-05-18  浏览次数:20535 次

不知道为什么在ASP.NET中查询数据库,每次都会从新建立连接.
我们刚把网站数据库从SQL   SERVER   2000转到SQL   SERVER   2005,连接串都没变,但是现在每个查询都会重新链接,在Logout很耗资源.以下是用跟踪器记录下来的部分

RPC:Completed exec   sp_reset_connection   .Net   SqlClient   Data   Provider test2user 0 0 0 0 2784 228 2007-04-23   14:15:00.640 2007-04-23   14:15:00.640 0X00000000000000002600730070005F00720065007300650074005F0063006F006E006E0065006300740069006F006E00
Audit   Login --   network   protocol:   TCP/IP
set   quoted_identifier   on
set   arithabort   off
set   numeric_roundabort   off
set   ansi_warnings   on
set   ansi_padding   on
set   ansi_nulls   on
set   concat_null_yields_null   on
set   cursor_close_on_commit   off
set   implicit_transactions   off
set   language   简体中文
set   dateformat   ymd
set   datefirst   7
set   transaction   isolation   level   read   committed
.Net   SqlClient   Data   Provider test2user 2784 228 2007-04-23   14:15:00.640
SQL:BatchStarting Select   *   from   testtable .Net   SqlClient   Data   Provider test2user 2784 228 2007-04-23   14:15:00.640
SQL:BatchCompleted Select   *   from   testtable .Net   SqlClient   Data   Provider test2user 0 2 0 0 2784 228 2007-04-23   14:15:00.640 2007-04-23   14:15:00.640
Audit   Logout .Net   SqlClient   Data   Provider test2user 0 70 0 216 2784 228 2007-04-23   14:15:00.640 2007-04-23   14:15:00.857
RPC:Completed exec   sp_reset_connection   .Net   SqlClient   Data   Provider test2user 0 0 0 0 2784 228 2007-04-23   14:15:00.857 2007-04-23   14:15:00.857

------解决方案--------------------
SQL Server 外围应用配置器—服务和连接外围配置—database englie—远程连接—启用(远程连接的TCP/IP和named pipes)
SQL Server Configuration Manager—SQL2005网络配置—启用TCP/IP和named pipes