您好我正在编写一个简单的控制台应用程序来使用批量复制将XML数据保存到数据库,但目前有问题连接到我的数据库。错误:40 - 无法打开连接到SQL Server
我得到一个错误的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服务器正在运行,并且它的正确配置的问题。以下是我的连接字符串。
string connectionString = @"Data Source=SYAZANA;Initial Catalog=WangSCM;integrated security=true;" ;
我在我的智慧结束试图找出错误,那是什么我做了错误?
SQL Server与程序是否在同一台机器上?如果没有,请检查SQL Server端的防火墙。至少应打开端口1433(默认实例)。 https://support.microsoft.com/de-ch/kb/968872/en-us SQL Server使用的更多端口 – Scoregraphic
@Scoregraphic感谢您的答复,是的,他们在同一台机器上,我已经检查这是端口1433 – zana
@zana请upvote并接受答案,如果它为你 –