sql server连接字符串与tcp/ip开启
2015-07-08 09:07
615 查看
连接字符串1:Data Source=localhost,1433;User ID=sa;Password=123;Initial Catalog=test;Min Pool Size=1;Max Pool Size = 512;
连接字符串2:Data Source=localhost;User ID=sa;Password=123;Initial Catalog=test;
SQL SERVER数据库中的TCP/IP如果没有开启,只能用第二句连接字符串,开启都可用。字符串1是通过走网络的。
如果你应用了第一句字符串,必须在SQL server配置器中开启tcp/ip,然后重启sql server服务。就OK
否则报错
System.Data.SqlClient.SqlException: 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接。) 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 在 System.Data.SqlClient.TdsParserStateObject.WriteSni() 在 System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode) 在 System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() 在 System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) 在 EISSQLServerDAL.SqlHelper.ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, String commandText,
连接字符串2:Data Source=localhost;User ID=sa;Password=123;Initial Catalog=test;
SQL SERVER数据库中的TCP/IP如果没有开启,只能用第二句连接字符串,开启都可用。字符串1是通过走网络的。
如果你应用了第一句字符串,必须在SQL server配置器中开启tcp/ip,然后重启sql server服务。就OK
否则报错
System.Data.SqlClient.SqlException: 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接。) 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 在 System.Data.SqlClient.TdsParserStateObject.WriteSni() 在 System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode) 在 System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() 在 System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) 在 EISSQLServerDAL.SqlHelper.ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, String commandText,
相关文章推荐
- 利用block封装网络请求类
- TCP/IP详解学习笔记——IP协议
- 五轴加工的RTCP技术
- CentOS系统时间与网络同步
- 黑马程序员——JAVA笔记——网络
- 从Linux 2.6.8内核的一个TSO/NAT bug引出的网络问题排查观点(附一个skb的优化点)
- 从Linux 2.6.8内核的一个TSO/NAT bug引出的网络问题排查观点(附一个skb的优化点)
- sysstat服务负载统计,如CPU占有率,网络使用率,磁盘速度
- sysstat服务负载统计,如CPU占有率,网络使用率,磁盘速度
- CentOs6.5下的网络配置
- Libghttp库使用指南
- HTTP 笔记与总结(1 )Telnet 分别发送 HTTP GET 和 HTTP POST 请求
- 计算机网络方面资料
- python发送HTTP请求的方法小结
- 网络编程学习笔记一:Socket编程
- 企业网络营销的关键点以及企业网络营销重点在哪里
- 经过一年时间的沉淀 再次回首 TCP Socket服务器编程
- 拼包函数及网络封包的异常处理(含代码)
- 菜鸟的网络编程之路(一) —— Socket的理解
- android下网络请求 connect 就抛出异常