Hi ,Jim you can give port number in connection string
Client is reaching out on the wrong port.
I have an application configured through SQLExpress 2012, which is configured to listen on tcp 1433 as the default.
Lately, we have desktop clients getting weird error messages trying to login to the app (Operation not allowed when the object is closed) and the one thing I've noticed about these workstations is that they are trying to connect on tcp 1434 instead of 1433.
Is there a way to change the client to connect to the correct port? Or, more broadly, why does this behavior suddenly change when most workstations were doing the correct thing and attempting to connect on 1433 until some time in the last few months.
5 answers
Sort by: Most helpful
-
-
Olaf Helper 46,041 Reputation points
2023-07-18T04:58:54.4433333+00:00 trying to connect on tcp 1434 instead of 1433.
TCP/IP port 1434 is used for the DAC = "Dedicated Admin Connection", I can't imagine your app is using that one. How do you get that?
Is SQL Server-Browser running; that one is reliable to resolve the instance name to the used IP port?
-
ZoeHui-MSFT 40,586 Reputation points
2023-07-18T06:04:07.1766667+00:00 Hi @Jim Weill,
Try below to check and re-set the port number.
1.In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, select Protocols for <instance name>, and then in the right pane double-click TCP/IP.
2.In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP address on the computer. (You may see both IP version 4 and IP version 6 addresses.) Right-click each address, and then select Properties to identify the IP address that you want to configure.
3.If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.
4.In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then select OK. Multiple ports may be specified by separating them with a comma. Select OK.
5.In the details pane, right-click SQL Server (<instance name>) and then select Restart, to stop and restart SQL Server.
Check: Configure SQL Server to listen on a specific TCP port
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.
-
Bruce (SqlWork.com) 71,506 Reputation points
2023-07-18T15:51:27.1133333+00:00 port 1434 is used by sql browser. this means the clients are trying to connect by named instance rather hostname.
note: sql browser uses UDP, so if it is not working, either the service is not running, or the packets are not being routed to the users local lan. Typically, just like the computer name browser, you need a sql browser running on every network segment.
-
Erland Sommarskog 116.9K Reputation points MVP
2023-07-18T16:57:07.1+00:00 Aha, are you saying there is something hard-coded to use a named instance? But even though other workstations are connecting correctly, how does this sort of thing just happen? Was there a MS SQL update that forces this?
No, this is something that happens client side. Check the configuration file on the machines with problem. And, as Dan points out, double-check that they are going to TCP 1434 and not UDP 1434. The latter is quite expected, because that is the port the Browser server is listening. And if client connects with an instance name, they first talk to the Browser service to get the port number.
Note also that the error message Operation not allowed when the object is closed is not message that primarily indicate a connection error. Maybe you should use Profiler when connecting from these workstations to see if they connect and run a query.