System.Data.SqlClient.SqlException:'已成功与服务器 Build 连接,但在登录过程中发生错误 . (提供者:TCP提供者,错误:0 - 操作成功完成)'
我正在尝试使用UWP APP连接到SQL Server 2008 R2数据库 .
-
启用了远程访问
-
防火墙规则已到位
-
目标版本是Windows 10 Fall Creators Update(10.0; Bulid 16299
-
最低版本是Windows 10 Fall Creators Update(10.0; Bulid 16299
-
Package.appxmanifest设置为
-
internetClient
-
internetClientServer
-
privateNetworkClientServer
-
enterpriseAuthentication
码:
using System.Data.SqlClient;
const string ConnectionString = "SERVER = XXXServer; DATABASE = XXXDatabase; USER ID = XXXUser; PASSWORD = XXXPass";
using (SqlConnection sqlConn = new SqlConnection(ConnectionString))
{
sqlConn.Open();
}
1 回答
我测试了UWP应用程序和SQL Server 2008 R2之间的连接,并可以重现您的问题 . 我还测试了UWP应用程序和SQL Server 2017之间的连接,使用相同的代码片段,相同的SQL服务器配置,它运行良好 . 因此,作为一种解决方法,我强烈建议您将SQL Server升级到2017,因为SQL Server 2008 R2已经过时not supported .
另外,不要忘记Enable TCP/IP Network Protocol for SQL Server,你在上面的描述中没有提到它 .