Cannot connect UWP app. to SQL Server 2017 instance:

北慕城南 提交于 2019-12-11 05:45:43

问题


UWP app. returns

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: TCP Provider, error: 25 - Connection string is not valid)"

Trying to connect to a SQL Server 2017 instance.

This is all on a local dev. machine, Windows 10 (no remote).

Have followed advice in SO to no avail: Connection string is not valid or Error Locating Server/Instance

  • SQL server service is running.
  • Can connect in SSMS.
  • "SQL Server Browser" Service is running, TCP/IP Enabled.
  • I stopped Kaspersky & then Windows firewall altogether. No joy.

Connection string that fails:

@"Data Source=JUPITER\MSSQLSERVER01;Initial Catalog=GumbysNorthwind;User ID=sa;Password=xxxxxx_xxxx";

Same UWP App does manage to connect to SQL server 2014 instance.

Any suggestions please?


回答1:


I followed the Use a SQL Server database in a UWP app document to do tests. I can connect to the sqlserver database successfully.

Please check the First, setup your solution section, if you have set the correct target/min version, capability etc.

My connection string is different from you. E.g, 'Data Source=172.xx.xx.xx;Initial Catalog=MyDataBase;;User ID=sa;Password=Password'

I have not stopped the Windows firewall, but I add a new rule in 'Inbound Rules'. I add the TCP port 1433 in the rule and allow the connection.



来源:https://stackoverflow.com/questions/52154445/cannot-connect-uwp-app-to-sql-server-2017-instance

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