Reputation: 43
I've hit an odd situation with connecting to a SQL Server instance. The instance is running and listening on port 1433 however I can't connect unless I specify the default port of 1433 in the connection string.
Does not work:
<add name="DataContext" connectionString="Data Source=192.168.150.1\sqlinstance;Initial Catalog=DATABASE;Persist Security Info=True;User ID=dbUser;Password=dbPass;MultipleActiveResultSets=True; Asynchronous Processing=true;Max Pool Size=700" providerName="System.Data.SqlClient" />
Does Work:
<add name="DataContext" connectionString="Data Source=192.168.150.1\sqlinstance,1433;Initial Catalog=DATABASE;Persist Security Info=True;User ID=dbUser;Password=dbPass;MultipleActiveResultSets=True; Asynchronous Processing=true;Max Pool Size=700" providerName="System.Data.SqlClient" />
This only started happening recently and only affects our testing environment. Our production environment is configured identical except for the IP address and it does not suffer from this. It's not a big deal to just add the port to the connection string but I'd like to figure out how this happened. I should also mention I don't have issues when using Management Studio or just using telnet to verify the port is open. I'm thinking this might be a C# or .net issue rather than a SQL Server configuration issue.
Upvotes: 4
Views: 3500
Reputation: 843
For me, I just needed to enable the service SQL Server Browser
, it was disabled.
Go to:
SQL Server Configuration Manager > SQL Server Services > SQL Server Browser
Right click -> Properties
Go to Service
tab
Start mode change to 'Automatic' or 'Manually' (whatever you decide) and voilà
Upvotes: 0
Reputation: 756
set ms sql client protocols "shared memory" and "named pipes" as disable if use only tcp ip - connection string without default port
Upvotes: 1