Skip to content

petros-d/SqlClient-Issue43

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlClient connections to SQL Server issue

dotnet/SqlClient#43

Reproducing issue

Issue is NOT reproducable on Windows 10 1903 machine with Docker for Windows 19.03.4. Summary steps:

  • Install SQL Server 2017 Express (https://www.microsoft.com/en-gb/sql-server/sql-server-editions-express) Direct download: https://go.microsoft.com/fwlink/?linkid=853017

  • Ensure SQL Server is listening on the correct IP's and ports

  • Generate certificate for SQL Server with inaccessible CRL defined, following instructions in pki/

  • Import certificate into Windows certificate store

  • Ensure SQL Server recognises certificate

  • Restart SQL Server

  • Edit dotnet3/Program.cs to replace DESKTOP-K0D29BB with hostname of SQL Server

  • Build and run dotnet3 image to see error message.

  • Delete certificate from Windows certificate store

  • Restart SQL Server

  • Run dotnet3 image with no error message

Troubleshooting

Test network connectivity to the SQL Server host from a docker container:

docker run --rm -it ubuntu bash apt-get update && apt-get install -y curl telnet dnsutils net-tools

nslookup DESKTOP-K0D29BB && \ telnet DESKTOP-K0D29BB 1433

Build docker containers:

Navigate to the dotnet3 directory

Run docker build command:

docker build -t dotnet3 . --no-cache

Run and test:

docker run --rm --add-host=DESKTOP-K0D29BB:192.168.255.154 dotnet3

Start in bash overwriting entrypoint (used to troubleshoot):

docker run --rm -it --entrypoint "/bin/bash" dotnet3

Install sqlcmd:

 apt-get update && \
 apt-get install -y gnupg && \
 curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
 curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list && \
 apt-get update && \
 apt-get install -y mssql-tools unixodbc-dev 

 apt-get install -y locales \
    && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
    && locale-gen

/opt/mssql-tools/bin/sqlcmd -S DESKTOP-K0D29BB -U sa -P TempPass123

Notes:

Tested with SQL Server 2017 Express on Windows 10 with openssl certificte with HTTP & LDAP CRL defined. All working. Tested with certificate generated by ADCS, with domain joined SQL Server VM. All working.