gpt4 book ai didi

C# Mysql 连接问题 - 连接尝试失败

转载 作者:行者123 更新时间:2023-11-29 12:49:31 24 4
gpt4 key购买 nike

加载 C# ASP.net 页面时出现以下错误。

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

[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) +6528783 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) +204 MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count) +128 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() +64
MySql.Data.MySqlClient.MySqlStream.ReadPacket() +32
MySql.Data.MySqlClient.NativeDriver.Open() +253
MySql.Data.MySqlClient.Driver.Open() +22
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +208 MySql.Data.MySqlClient.MySqlConnection.Open() +625 UoRLive.iPadLayout.Page_Load(Object sender, EventArgs e) in c:\Users\Corbin Spicer\Documents\FinalYearProject\UoRLive\UoRLive\iPadLayout.aspx.cs:92 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

背景:

当尝试连接到本地 MYSQL 数据库时,该脚本在本地计算机上完美运行,但是我已将其移至 smarterasp.net,设置了另一个 MYSQL 数据库,现在收到此错误消息。

唯一改变的是连接字符串:

public static string GetConnectionString()
{


string connStr = String.Format("server={0};user id={1}; password={2}; port={3};" +
"database=MYDATABASE_resources; pooling=false", "SQL5011.Smarterasp.net",
"DMYDATABSE_resources_admin", "MyPassword", "1433");


return connStr;
}

详细信息 100% 正确,我已通过使用 MYsql Workbench 连接到服务器来检查它们。

有什么想法吗?

最佳答案

1433 是默认 SQL Server 端口。

3306 是默认的 MySQL 端口。

关于C# Mysql 连接问题 - 连接尝试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24979218/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com