问题
So we have SQL Server 2008 R2 Express running on a local server, and a bunch of machines on the same LAN use a program I wrote in C# to access said server.
All the machines in the building except one can connect quite happily.
Connection string is:
Data Source=[IP address here],53535\SQLEXPRESS;Initial Catalog=EMS_Main;;User ID=EMSUser;Password=[password here];
Exact error message is:
"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: 0 - An invalid argument was supplied.)"
Struggling to believe the 'invalid argument' bit, given that all other machines connect quite happily.
SQSL is definitely configured to accept remote connections, instance name is definitely correct.
The problem machine can connect using SQLSMS, but not via C#.
Disabling firewall on the problem machine makes no difference.
Everything seems to have been working fine on the problem machine up until a Windows 10 update a couple of days ago.
EDIT: An update on this: I now have two machines with this issue, and they both seem to have only developed it after Windows 10 updated to version 1803. All the pre-1803 machines still work fine.
Can anyone shed any more light on this please?
回答1:
For anyone else hitting this issue, I discovered that this was happening because the client application was being run from a shared drive, and Windows 10 update 1803 must have some security update in it that causes this problem (only machines running 1803 were affected).
Running the application from the machine's hard drive solved the problem.
I'd still like to know a technical explanation for this, even though the problem is solved.
回答2:
I have the same issue. A dig deeper and discovered that this happened after installing an update (May 8, 2018—KB4103721). Try to uninstall this update or use named pipes instead tcp.
来源:https://stackoverflow.com/questions/50348869/sql-server-invalid-argument-supplied