当我尝试使用 Windows 通用 PlatformApp 连接到 SQL Server 2008R2 时出现 System.Data.SqlClient.SqlException [英] System.Data.SqlClient.SqlException when I try to connect to SQL Server 2008R2 with a Windows Universal PlatformApp

查看:18
本文介绍了当我尝试使用 Windows 通用 PlatformApp 连接到 SQL Server 2008R2 时出现 System.Data.SqlClient.SqlException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,当我尝试使用 System.Data.SqlClient 从 Windows 通用平台应用程序连接到 Microsoft SQL Server 2008R2 时,出现以下异常:

Hi when I try to connect to a Microsoft SQL Server 2008R2 using System.Data.SqlClient from a Windows Universal Platform App I get following exception:

System.Data.SqlClient.SqlException: '与服务器建立连接成功,但在登录过程中出现错误.(提供者:TCP Provider,错误:0 - 操作成功完成)'

System.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The operation completed successfully)'

这是我的连接字符串,我正在使用 SQL 身份验证:

This is my connection string, I'm using SQL Authentification:

string connectionString = "{Data Source=xxx.xxx.xxx.xxx; Initial Catalog=TheDatabase;Integrated Security=false;User ID=user;Password=Password}"

当我尝试连接到 2016 SQL Server 时,一切正常,这是我的代码:

When I try to connect to a 2016 SQL Server everithing works, here is my code:

using (SqlConnection connection= new SqlConnection(connectionString))
    {
        connection.Open();
    }

connection.Open() 处抛出异常

The exception is been thrown at connection.Open()

需要考虑的事项:

  • 我已经在 Package.appxmanifest (enterpriseAuthentication, privateNetworkClientServer) 中设置了所有需要的权限
  • SQL 服务器同时具有 Windows 和 SQL 身份验证,并启用了 TCP
  • 软件包的目标版本是 Windows 10 Fall Creators Update(10.0; Bulid 16299)
  • 我已经尝试过Integrated Security = true,异常也是一样
  • 其他应用程序(非 WUP)在 2008R2 服务器上运行良好,并且也是使用 .NET 的 C# 应用程序

这个线程解释了同样的问题:问题链接

This thread explanes the same issue: link to the question

Service Pack 3 for SQL Server 2008R2 有帮助吗?

Could Service Pack 3 for SQL Server 2008R2 help?

是否有解决方法或更好的方法使 2008R2 与 WUP 一起使用?

Are there workarounds or better ways to make 2008R2 work with WUP?

推荐答案

安装 2008R2 Service Pack 解决了这个问题.我试图用 2008R2 Express 在我的本地电脑上重现该问题.我重现了这个问题,在我更新到 2008R2 Service Pack 2 Express 之后,一切都完美无缺.

Installing 2008R2 Service Pack solved the issue. I tried to reproduce the problem on my local pc with 2008R2 Express. I reproduced the issue and after I did the update to 2008R2 Service Pack 2 Express everything worked flawlessly.

我将在生产环境中安装 Service Pack 3,如果它工作正常,我会更新您

I'll install the Service Pack 3 on production and update you if it's working

这篇关于当我尝试使用 Windows 通用 PlatformApp 连接到 SQL Server 2008R2 时出现 System.Data.SqlClient.SqlException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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