远程服务器的SQL连接错误

时间:2011-08-23 00:35:18

标签: c# sql-server tsql

您好我在C#中有一个应用程序从远程托管服务器(winhost)下载数据以同步到本地sql服务器(复制不是一个选项)...非常小的数据集10-100用于测试我是只检索2行。该应用程序在我的开发机器上运行正常。然而,在客户端网络上,我得到一个间歇性的错误说一半的时间:

Error Occurred Getting Record From Remote Server: Details =>    System.Data.SqlClient.SqlException (0x80131904): 
A network-related or instance-specific error occurred while establishing a connection  to SQL Server. 
The server was not found or was not accessible. Verify that the instance name is  correct and that SQL Server 
is configured to allow remote connections. (provider: SQL Network Interfaces, error:  26 - Error Locating 
Server/Instance Specified) at  System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, 
Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()     At 
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,  SqlInternalConnectionTds connHandler, 
Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean  trustServerCert, Boolean integratedSecurity)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo  serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout,  SqlConnection owningObject) at 
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,  String newPassword, 
Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString  connectionOptions, 
TimeoutTimer timeout) at  System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection 
owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String  newPassword, Boolean redirectedUser
Instance) at  System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,  SqlConnectionString 
connectionOptions, Object providerInfo, String newPassword, SqlConnection  owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions  options, Object 
poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at  System.Data.ProviderBase.
DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection,  DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection  owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection  owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, 
DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()  at 
System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) at    AfocImport.Program.Main(String[] args)

在我的开发机器上我有20 mb / s下来,应用程序工作没有问题从未遇到此错误,但客户端是T1 1.5mb / s下来。我假设这是问题,但它也可能是客户端网络上的东西(我检查过防火墙)......

所以我的问题是这个错误只是指示连接超时,还是可能是别的?如果是的话,我能做些什么来纠正这种情况(不幸的是,这是客户唯一可用的互联网)。我尝试搞乱连接超时,但这似乎没有什么区别。

1 个答案:

答案 0 :(得分:0)

ping / tracert是什么样的?如何尝试使用端口1433上的telnet连接到远程服务器?我的猜测是端口被阻止或DNS没有解析。您是否尝试按名称连接到远程服务器?你试过IP地址吗?