没有这样的主机是已知的
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Net.Sockets.SocketException:没有这样的主机是已知的
源错误:
Line 21: MySqlConnection conn = new MySqlConnection(MyConStrings);
Line 22: MySqlCommand cmd = new MySqlCommand("SELECT id ,name FROM asd_table Where weekno ='"+getWeek+"';", conn);
Line 23: conn.Open(); //red highlight here
堆栈跟踪:
[SocketException (0x2af9): No such host is known]
System.Net.Dns.GetAddrInfo(String name) +6603642
System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) +106
System.Net.Dns.GetHostEntry(String hostNameOrAddress) +109
MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix) +64
MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings) +38
MySql.Data.MySqlClient.NativeDriver.Open() +55
[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
MySql.Data.MySqlClient.NativeDriver.Open() +151
MySql.Data.MySqlClient.Driver.Open() +22
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +208
MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +261
MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +93
MySql.Data.MySqlClient.MySqlPool.GetConnection() +65
MySql.Data.MySqlClient.MySqlConnection.Open() +625
play_db_mysql.Page_Load(Object sender, EventArgs e) in d:\hosting\folder1\html\web\website\asd_db_mysql.aspx.cs:23
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
一直被这个问题困扰着,我的 sql db 托管在 godaddy 中,这是我在 .cs 文件中使用的连接字符串
String MyConStrings = "SERVER=serverurl;" +
"DATABASE=dbname;" +
"UID=username;" +
"PASSWORD=passsword;";
任何帮助将非常感激。