1

I'm connecting to a SQL server on another PC in our network. While coding this UWP app (using the latest versions of everything, i.e., SQL, Windows 17763) everything works fine. Queries are returning results. I'm using VS 2017.

However, when I created a package for it to sideload to other PCs (including on the PC where the server is), I get an error saying the server was not found or not accessible:

provider: TCP Provider, error: 25 - Connection string is not valid

For reference, the generated connection string is as simple like:

Data Source=PC-1\\SQLEXPRESS;Initial Catalog=NewDatabase;User ID=sa;Password=password

I checked every other thread I could find on this topic. I even got the Capabilities checklist covered too - Private Networks, Internet (Client & Server)

What could be causing this error?

UPDATE: The sideloaded app does work when installed in other PCs except the one where the SQL server instance is, for some reason.

AwonDanag
  • 329
  • 1
  • 11
  • Have you tried to use IP address instead of 'PC-1' to see if it will work? – Xie Steven Mar 04 '19 at 09:01
  • Hey @XavierXie-MSFT, yes, we did try all sorts. Including connecting with TCP/IP (PC-1, 1433). Strange thing is, the sideloaded app *CAN* connect when installed in another PC in the network other than the PC where the server is... – AwonDanag Mar 11 '19 at 08:57
  • I saw that you mention the TCP port 1433. Please open the ‘SQL Server Configuration Manager’ and check the TCP port if it is the default 1433. Once I had a customer whose port was not the default 1433. – Xie Steven Mar 19 '19 at 01:43
  • Any update? I have the same issue... burned days on it without solution – Tomino Sep 03 '19 at 20:50

1 Answers1

0

You need to add exception for loopback. For some weird reason, you cannot connect to localhost from sideloaded UWP application. But it works when you run the app from visual studio debug.

Please see: UWP Enable local network loopback

Tomino
  • 5,969
  • 6
  • 38
  • 50