title: No connection could be made because the target machine actively refused it(selenium)
body: <p>I have extracted the following code from selenium IDE.(c# remote control)</p>
  
  <pre><code>using System;
  using System.Text;
  using System.Text.RegularExpressions;
  using System.Threading;
  using NUnit.Framework;
  using Selenium;
  
  namespace SeleniumTests
  {
  [TestFixture]
  public class MyFirstVCTest
  {
      private ISelenium selenium;
      private StringBuilder verificationErrors;
  
      [Test]
      public void TheNewTest()
      {
          selenium.Open("/");
      } 
  
      [SetUp]
      public void SetupTest()
      {
          selenium = new DefaultSelenium("localhost", 4444, "*chrome","http://demo.volunteercampaigns.com/");
          selenium.Start();
          verificationErrors = new StringBuilder();
      }
  
      [TearDown]
      public void TeardownTest()
      {
          try
          {
              selenium.Stop();
          }
          catch (Exception)
          {
              // Ignore errors if unable to close the browser
          }
          Assert.AreEqual("", verificationErrors.ToString());
      }
  
      [Test]
      public void TheMyFirstVCTest()
      {
          selenium.Open("/?AspxAutoDetectCookieSupport=1");
          selenium.Click("link=Login");
          selenium.WaitForPageToLoad("30000");
          selenium.Type("id=ctl00_ContentPlaceHolder1_txtEmailAddress", "elonadminss@eeeorbees.com");
          selenium.Type("id=ctl00_ContentPlaceHolder1_txtPassword", "orbs123");
          selenium.Click("id=ctl00_ContentPlaceHolder1_btnlogin");
          selenium.WaitForPageToLoad("30000");
          selenium.Click("id=ctl00_lblUserName");
          selenium.Click("id=ctl00_lnkSignOut");
          selenium.WaitForPageToLoad("30000");
      }
  }
  }
  </code></pre>
  
  <p>i created a webform and added a button there.</p>
  
  <p>in button click event i wrote this code</p>
  
  <pre><code>SeleniumTests.MyFirstVCTest m = new SeleniumTests.MyFirstVCTest();
      m.SetupTest();
      m.TheMyFirstVCTest();
      m.TeardownTest();
  </code></pre>
  
  <p>i included all .dll files. its running fine(no errors and warnings).</p>
  
  <p>but after clicking button i am getting the following error</p>
  
  <pre><code>No connection could be made because the target machine actively refused it 127.0.0.1:4444
  </code></pre>
  
  <p>what should i do??</p>
  
  <p>thanks in advance..</p>
  
  <p><strong>Note to viewers</strong>: This post may help you : <a href="http://coding-issues.blogspot.com/2012/11/no-connection-could-be-made-because.html" rel="noreferrer">No connection could be made because the target machine actively refused it</a></p>