SQL Server connection string opens with TCP/IP

Source: Internet
Author: User
Tags first string sql server connection string

Connection string 1:data source=localhost,1433; User Id=sa; Password=123;initial catalog=test; Min Pool size=1; Max Pool Size = 512;

Connection string 2:data source=localhost; User Id=sa; Password=123;initial catalog=test;

TCP/IP in SQL Server database if not turned on, only the second sentence of the connection string, open is available. String 1 is done by walking the network.

If you apply the first string, you must turn on TCP/IP in the SQL Server Configurator and then restart the SQL Server service. Just OK.

Otherwise the error

System.Data.SqlClient.SqlException: A transport-level error occurred while sending a request to the server. (PROVIDER:TCP provider, error:0-the remote host forced the shutdown of an existing connection.) )     in System.Data.SqlClient.SqlConnection.OnError (SqlException exception, Boolean breakconnection)     in System.Data.SqlClient.SqlInternalConnection.OnError (SqlException exception, Boolean breakconnection)     in System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning ( Tdsparserstateobject stateobj)     in System.Data.SqlClient.TdsParserStateObject.WriteSni ()      in System.Data.SqlClient.TdsParserStateObject.WritePacket (Byte flushmode)     in System.Data.SqlClient.TdsParserStateObject.ExecuteFlush ()     in System.Data.SqlClient.TdsParser.TdsExecuteRPC (_sqlrpc[] rpcarray, Int32 timeout, Boolean Inschema, SqlNotificationRequest notificationrequest, Tdsparserstateobject stateobj, Boolean iscommandproc)     In System.Data.SqlClient.SqlCommand.RunExecuteReaderTds (CommandBehavior cmdBehavior, Runbehavior Runbehavior, Boolean Returnstream, Boolean async)     in System.Data.SqlClient.SqlCommand.RunExecuteReader (CommandBehavior cmdbehavior, Runbehavior Runbehavior, Boolean Returnstream, String method, dbasyncresult result)     in System.Data.SqlClient.SqlCommand.RunExecuteReader (CommandBehavior cmdbehavior, Runbehavior Runbehavior, Boolean Returnstream, String method)     in System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior Behavior, String method)     in System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)     in EISSQLServerDAL.SqlHelper.ExecuteReader (SqlConnection connection, sqltransaction Transaction, CommandType CommandType, String CommandText,

SQL Server connection string opens with TCP/IP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.