我尝试使用Windows Universal PlatformApp连接到SQL Server 2008R2时出现System.Data.SqlClient.SqlException
嗨,当我尝试从Windows通用平台应用程序使用System.Data.SqlClient连接到Microsoft SQL Server 2008R2时,我得到以下exception:
System.Data.SqlClient.SqlException:’已成功与服务器建立连接,但在登录过程中发生错误。 (提供者:TCP提供者,错误:0 – 操作成功完成)’
这是我的连接字符串,我正在使用SQL Authentification:
string connectionString = "{Data Source=xxx.xxx.xxx.xxx; Initial Catalog=TheDatabase;Integrated Security=false;User ID=user;Password=Password}"
当我尝试连接到2016 SQL Server的作品时,这是我的代码:
using (SqlConnection connection= new SqlConnection(connectionString)) { connection.Open(); }
在connection.Open()上抛出了exception
需要考虑的事项:
- 我已经在Package.appxmanifest(enterpriseAuthentication,privateNetworkClientServer)中设置了所有必需的预留
- SQL Server具有Windows和SQL身份validation,并启用了TCP
- 该软件包的目标版本是Windows 10 Fall Creators Update(10.0; Bulid 16299)
- 我已经尝试过Integrated Security = true,exception是一样的
- 其他应用程序(非WUP)在2008R2服务器上运行良好,也是带.NET的C#应用程序
这个主题解释了同样的问题: 链接到问题
SQL Server 2008R2的Service Pack 3可以提供帮助吗?
是否有解决方案或更好的方法使2008R2与WUP协同工作?
安装2008R2 Service Pack解决了这个问题。 我尝试使用2008R2 Express在我的本地电脑上重现问题。 我重现了这个问题,在我对2008R2 Service Pack 2 Express进行更新后,一切都运行得很完美。
我将在生产中安装Service Pack 3并在其工作时更新您