Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document SQL Server Named Pipes configuration for tests #3192

Open
Wraith2 opened this issue Mar 2, 2025 · 8 comments
Open

Document SQL Server Named Pipes configuration for tests #3192

Wraith2 opened this issue Mar 2, 2025 · 8 comments
Labels
💡 Enhancement Issues that are feature requests for the drivers we maintain. 🆕 Triage Needed For new issues, not triaged yet.

Comments

@Wraith2
Copy link
Contributor

Wraith2 commented Mar 2, 2025

SqlClient can use TCP or Named pipes to connect to the sql server and there are tests that are forced to run on each protocol to make sure they work. In order to have the tests run a connection string must be provided and named pipes must be configured on the test machine and sql server machine.

But how? In the past I had assumed that my installation of SQL Server had somehow been broken or misconfigured by me but i've recently done a complete new build on new hardware and yet named pipes still do not work locally for me. I've spent time in the past looking into why and got nowhere.

In order to have named pipe specific tests run correctly locally i need to be able to correctly configure the sql server, local named pipe client and test json file. Can exact instructions from a clean install of SQL Server and Windows be provided to help with this please?

@Wraith2 Wraith2 added 💡 Enhancement Issues that are feature requests for the drivers we maintain. 🆕 Triage Needed For new issues, not triaged yet. labels Mar 2, 2025
@ErikEJ
Copy link
Contributor

ErikEJ commented Mar 3, 2025

@Wraith2 Is that not explained in the BuildGuide? - you need to add a NPConnectionString to config.json

https://github.com/dotnet/SqlClient/blob/main/BUILDGUIDE.md

@Wraith2
Copy link
Contributor Author

Wraith2 commented Mar 3, 2025

Yes, that part is documented and fairly obvious. I did as instructed. It has never worked for me. I get cannot connect on any attempt by the tests to use the named pipe protocol.
I need to know what setup on the sql server and host os is required.

@MichelZ
Copy link
Contributor

MichelZ commented Mar 3, 2025

It's fairly easy, you go to SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for xxx -> Named Pipes -> Enabled -> Yes (Restart the SQL Service)

https://webfiles-sc1.blackbaud.com/files/support/infinityinstaller/content/installermaster/tkenablenamedpipesandtcpipconnections.htm

@Wraith2
Copy link
Contributor Author

Wraith2 commented Mar 3, 2025

Yup:

Image

Named pipes don't work in this configuration. Didn't on my last build and I assumed I'd screwed it up somehow. This time I've left it alone and not messed with it other than enabling it, still doesn't work.

@MichelZ
Copy link
Contributor

MichelZ commented Mar 3, 2025

I do believe that's all that's needed.
Note that the connection string might need to change depending on how SQL Server is setup.
Default instance: \\.\pipe\sql\query
Named instance: \\<computer_name>\pipe\MSSQL$<instance_name>\sql\query

@David-Engel
Copy link
Contributor

I think the instructions are missing because it just works for everyone with the SQL Server install defaults and the NP Connection string in config.default.json ("NPConnectionString": "Data Source=np:localhost;Database=Northwind;Integrated Security=true;Encrypt=false;")

Really strange that it's never worked for you. What error(s) do you get?

Thinking about when I install SQL Server, the only non-standard things I do is enable mixed mode authentication so that I can also use SQL auth and add my local Windows account as an admin.

@Wraith2
Copy link
Contributor Author

Wraith2 commented Mar 3, 2025

I always use mixed mode installs and I always use named instances because I've found that I'm likely to end up with different versions and purposes for instances. Using the full named pipe as @MichelZ detailed above seems to work on my current build but did not on my previous system.

I'd like it if the documentation provided information on how to identify or construct the connection strings for named pipes even if that's just a link the the relevant documentation.

@David-Engel
Copy link
Contributor

For a named instance, isn't your connection string just: "NPConnectionString": "Data Source=np:localhost\MyNamedInstance;Database=Northwind;Integrated Security=true;Encrypt=false;"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Enhancement Issues that are feature requests for the drivers we maintain. 🆕 Triage Needed For new issues, not triaged yet.
Projects
None yet
Development

No branches or pull requests

4 participants