Error Connecting to Named Instance

  • I had to install a new instance of SQL Server 2008 R2 Express on Windows 2007 because our SQL Server 2008 R2 Trial version ended (It's just a development machine). I was able to connect to the Express version using SSMS using the machine name\instance name but couldn't connect using the web config from our web service (error establishing connection to SQL Server - error 40). Everything is local. I did read that you if you have a named instance, it connects with dynamic ports but I wasn't sure if this was true when everything is local but I did try changing the port to a fixed one and opened the windows firewall but it still didn't work. So I then changed the port to the default port of 1433 and it did work. So three questions: 1) does that mean I didn't open the firewall correctly when I had another port (I used 1435, which didn't seem to be in use by other program)? 2) In using 1433, it complained that the database name was incorrect and it mentioned the old database name that we used to call that database. But I changed our current database name to that old name and all worked fine. Not sure why/how it found/used that old name? 3) Any issue leaving it as the default port at 1433 when it is a named instance? Does it matter? Thank you!

  • Hi,

    This could have more than few speculations, usually it is necessary to have sql browser service to be running if you're using named instance if you hadn't uninstalled previous default instance, and since you used custom port, did you happen to configure that port for the instance in the connection string?

    Regards,

  • Hi, yes, I did add the port number to the connection string in the web.config in the format of machine\instance,port (in the same format as I connected via SSMS) and I did update the configuration for the instance in the SQL Server Configuration Manager adding the port. But it didn't work. But once I added the default port (1433) to the instance in the SQL Server Configuration Manager it did work. I had tried the Browser Service as well but couldn't get that to work so that's when I tried just tried using the default port of 1433. I think some how even though I updated my firewall it just didn't work somehow. And everything is local so I wouldn't think that I would need to update the ports but I did. Also the weird thing is that when using the default port, it uses our old database name. Thank you.

  • Fixed, I had a typo in the port assignment.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply