DapperLib / DapperLib/Dapper

SQL Server Browser error when connecting to Docker Sql Server Container

Open
#2,004 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Hi, when trying to use Dapper from inside a C# .Net 7 API Docker Container to a Sql Server 2022 Docker Container i get an error:
Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started.

The connection string has the IP adress of the Docker Sql container and the port specified (i have tried even with container name and port number).
"Data Source=<ip adress>,1433;Initial Catalog=<db name>;Persist Security Info=True;User ID=<user>;Password=<strong password>;TrustServerCertificate=True;"

The Docker containers are on the same network and are visible to each other.

If i try to execute the same Stored Procedure/ Query using other methods (like SqlCommand)the connection is established and data is retrieved, so the Database is accessible.

Dapper Nuget version installed in C# .NET 7 Api solution: 2.1.24
I am using this Sql Server Docker image: "mcr.microsoft.com/mssql/server:2022-latest"

How can i solve this issue?

Thank you very much in advance.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are mentioned. Start by comparing the Dapper connection attempt with the working SqlCommand attempt using the same connection string, then verify the Docker containers' network and SQL Server port configuration. Done means the stored procedure or query runs through Dapper without the SQL Server Browser error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, sql
Domain
backend, databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.