Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

my connection string for connecting online mysql database is
MySqlConnection conn = new MySqlConnection
("Server=119.18.57.14;port=8443;UserId=medsoftn_webadmin;Password=ycmou786;Database=medsoftn_cms;");
Im i giving wrong port no for connecting mysql database
stack trace is

VB
[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond]
   System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +6508807
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +130

[IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +296
   MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) +47

[TimeoutException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.]
   MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) +465899
   MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count) +127
   System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) +262
   MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) +42
   MySql.Data.MySqlClient.MySqlStream.LoadPacket() +63
   MySql.Data.MySqlClient.MySqlStream.ReadPacket() +31
   MySql.Data.MySqlClient.NativeDriver.Open() +241
   MySql.Data.MySqlClient.Driver.Open() +22
   MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +250
   MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +285
   MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +91
   MySql.Data.MySqlClient.MySqlPool.GetConnection() +67
   MySql.Data.MySqlClient.MySqlConnection.Open() +565
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +316
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +88
   CityMaster.DataBind() in c:\new\BuzyDoctor\CityMaster.aspx.cs:125
   CityMaster.Page_Load(Object sender, EventArgs e) in c:\new\BuzyDoctor\CityMaster.aspx.cs:27
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Posted
Updated 6-Jan-22 19:15pm

1 solution

1.This error could occur because either the firewall on the server has refused the connection or the server is not configured to accept remote connections.

2.To fix it you should check first your SQL Server settings in order to allow remote connection, and after that the firewall from the server (where SQL Seerver is installed).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900