SQL Server连接问题 [英] SQL Server connection issue

查看:230
本文介绍了SQL Server连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VSTS 2008 +的.Net 3.5 + C#+ SQL Server 2008企业版的Windows Server 2003上我使用下面的连接字符串,并labtest1是本地机器名,并从本地机器使用ADO.Net我联系。然后,它总是连接错误而失败。但是,当我在连接字符串中更改从labtest1为。,连接具有相同的ADO.Net客户端code无问题。任何想法有什么不好?

I am using VSTS 2008 + .Net 3.5 + C# + SQL Server 2008 Enterprise on Windows Server 2003. I am using the following connection string, and labtest1 is the local machine name and I connect from local machine using ADO.Net. Then it always fail with connection error. But when I change in the connection string from "labtest1" to ".", connection has no issue with the same ADO.Net client code. Any ideas what is wrong?

Data Source=labtest1;Initial Catalog=CustomerDB;Trusted_Connection=true;Asynchronous Processing=true

下面是我得到了详细的错误信息,

Here is the detailed error message I got,

System.Data.SqlClient.SqlException:在与SQL Server建立连接时出现与网络相关的或特定于实例的错误。服务器找不到或无法访问。验证实例名称是否正确,以及SQL Server配置为允许远程连接。 (provider:命名管道提供程序,error:40 - 无法打开到SQL Server的连接)

System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

在此先感谢, 乔治

推荐答案

看起来像一个SQL Server配置问题对我说:你有没有在SQL Server网络配置试图调整协议?命名管道或TCP / IP应该启用。

Looks like a Sql Server configuration issue to me : have you tried to tune protocols in Sql Server Network configuration ? Named Pipes or TCP/IP should be enabled.

这篇关于SQL Server连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆