I came across this because I just had problems creating a remote connection and couldn't understand why setting up 1433 port in firewall is not doing the job. I finally have the full picture now, so I thought I should share.
First of all is a must to enable "TCP/IP" using the SQL Server Configuration Manager under Protocols for SQLEXPRESS!
When a named instance is used ("SQLExpress" in this case), this will listen on a dynamic port. To find this dynamic port you have couple of options; to name a few:
checking ERRORLOG
of SQL Server located in '{MS SQL Server Path}\{MS SQL Server instance name}\MSSQL\Log'
(inside you'll find a line similar to this: "2013-07-25 10:30:36.83 Server Server is listening on [ 'any' <ipv4> 51118]"
--> so 51118 is the dynamic port in this case.
checking registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\{MSSQL instance name}\MSSQLServer\SuperSocketNetLib\Tcp\IPAll
, for my case TcpDynamicPorts=51118
.
Edit: {MSSQL instance name}
is something like: MSSQL10_50.SQLEXPRESS
, not only SQLEXPRESS
Of course, allowing this TCP port in firewall and creating a remote connection by passing in: "x.x.x.x,51118"
(where x.x.x.x is the server ip) already solves it at this point.
But then I wanted to connect remotely by passing in the instance name (e.g: x.x.x.x\SQLExpress
). This is when SQL Browser service comes into play. This is the unit which resolves the instance name into the 51118 port. SQL Browser service listens on UDP port 1434 (standard & static), so I had to allow this also in server's firewall.
To extend a bit the actual answer: if someone else doesn't like dynamic ports and wants a static port for his SQL Server instance, should try this link.