SQL SERVER – Could not connect to TCP error code 10061: No connection could be made because the target machine actively refused it

I was recently getting following error in my StreamInsight Application.

Could not connect to  TCP error code 10061: No connection could be made because the target machine actively refused it.

The solution was very simple, I had to enable exception of the my port in my windows firewall. The way I figured it out  was by quickly disabling the firewall (it was not a production server). Once I disabled it, the application just worked fine; this was a sign that the firewall was the cause of the issue, I right away enabled firewall and added my port as exception.

So many errors have cropped up recently due to the connectivity issue. I have started to make my routine to check firewall first before I move to next action item in my troubleshooting list.

When I sent this detail to my internal technical list of the expert, I got the suggestion that this error happens due to many other reasons as well and not only due to firewall.

I am interested to know when and how this error happens and what is the resolution. This way, if we have complete list, we can avoid this error in future.

Watch SQL in Sixty Seconds video to Resolve Connection Error:

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Error Messages
Previous Post
SQLAuthority News – SQL Server Performance Optimizations Seminar – Grand Success – Colombo, Sri Lanka – Oct 4 – 5, 2010
Next Post
SQLAuthority News – Book Review – Beginning SQL Joes 2 Pros: The SQL Hands-On Guide for Beginners

Related Posts

23 Comments. Leave new

  • Nakul Vachhrajani
    October 21, 2010 10:47 pm


    This execption/error stumps most developers/IT staff who have just recently been exposed to Windows Server 2008 R2. I belive the R2 blocks incoming transactions by default, while the vanilla-2008 did not. Therefore, all of a sudden a system/database that worked fine on a Windows 2008 Server fails to accept connections from remote machines when upgraded to run on Windows 2008 R2 Server.

  • Nishant Rapate
    June 6, 2012 3:15 pm

    I am facing the same database connetivity issue but i am connecting to local database where firewall not comes in the picture.

    please suggest.

  • Same to me

  • exec sp_SendSmtpMail ‘vasudevveeramalla.veeramalla@emirates.com’,’vasudevveeramalla.veeramalla@emirates.com’,”,”,’Test Subject’,’Test Message’,1

    When am executing the above procedure am getting like this error

    Description: The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available

    Can you please any one help to resolve the issue

  • I’ve disabled the firewall on my Windows Embedded 2009 POSReady and I’m still not able to connect to the DB. What are some other avenues to pursue. It’s all local to one machine, not networked.

  • Reply
  • Awesome..Life saver

  • Thanks very much it was very helpful and resolved my problem.

  • Wow… your solution work, i am able clear the performance test

  • I had the same error which was coming and dont need to worry about this error, just restart the server and restart the SQL services. This issue comes when there is low disk space issue and system will go into hung state and then the sql services will stop automatically.

  • Though the firewall was disabled for the specific port I had the same problem.
    SQL Server Browser was turned off, switching on the browser solved the issue.
    Before I’ve not known anything about this browser…

  • Unbelievable!!!! Critical information. Every Non-Expert should have this video a click away.

    Thank you so much!!

  • Thank you. very helpfull.
    it was very easy

  • Hi Pinal,
    I have slightly more inexplicable issue.
    I have SQL 2012 Standard installed on one server called SQL01, running Server 2008 R2 Datacentre 64-bit
    There are 3 instances on there, one default and two named instances.
    I have another server called APP13 running Server 2012 R2 Datacentre 64-bit with SQL 2012 Management Studio installed on it.
    Both servers are on the same LAN and domain, and I am logging onto both servers with the domain admin credentials. All SQL instances are using Mixed Mode Auth, and the domain admin is sysadmin on all instances.

    From SQL01 using management studio, I can connect to all 3 instances fine using SQL01\instancename convention.
    From APP13 using management studio, I can only connect to the default instance using SQL01
    I can connect to the named instances also, but only using the IP address of SQL01, not with servername.

    Windows firewall on both servers has been disabled, remote connections allowed on all instances, and named pipes and TCP/IP enabled through SQL Server Config Manager.
    The SQL Browser service has been re-started, but SQL01 cannot be seen from Management Studio on APP13, but as mentioned before, I can connect to the default instance by manually typing in SQL01
    I have tried adding an entry into the hosts file, for SQL01, but this made no difference.

    The error is:
    Cannot connect to SQL01\ABC.
    Addtional information:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 – No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

    Any help or suggestions appreciated.
    Kind Regards,

  • I still get error 10061, even after seeing the video and adjusting the procedure accordingly. What else can this be. I’m really stuck at this point. please advise, thank you

  • I still get error 10061, even after seeing the video and adjusting the procedure accordingly. What else can this be. I’m really stuck at this point. please advise, thank you

  • Dear Sir,
    Thanks a lot for the valuable information. By reading/looking this I could solve the issue.

    The problem is that it can connect through the local network (192.168.*.*) but fails when connect through public IP.

    Are there any solutions for its?

  • I don’t know the reason why for not being able to connect. but, to solve this issue if it is a cluster just fail it over manually from the failover cluster manager from NODE1 to NODE2 and failback from NODE2 to NODE1 and the issue will be resolved then you will be able to connect back.


Leave a Reply