System.Data.SqlClient.SqlException when I try to connect to SQL Server 2008R2 with a Windows Universal PlatformApp

≡放荡痞女 提交于 2019-12-20 07:45:26

问题


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: '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)'

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}"

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

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

The exception is been thrown at connection.Open()

Things to consider:

  • I've already set all needed premission in the Package.appxmanifest (enterpriseAuthentication, privateNetworkClientServer)
  • The SQL server has both Windows and SQL Authentification and has TCP enabled
  • The target version of the package is Windows 10 Fall Creators Update(10.0; Bulid 16299)
  • I already tried Integrated Security = true, and the exception is the same
  • Other applications (non WUP) are working fine with the 2008R2 Server and are also C# apps with .NET

This thread explanes the same issue: link to the question

Could Service Pack 3 for SQL Server 2008R2 help?

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/51087826/system-data-sqlclient-sqlexception-when-i-try-to-connect-to-sql-server-2008r2-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!