No connection could be made because the target machine actively refused it

Hi

I experience problem accessing a web service installed on my development machine.

If I create an ASP.Net web site, I can access the web service with no problem. I need to access the web service from a C# windows application.

In order to do that, I added the webservice as a web reference to the project, initialise the proxy class. when I try to access a webservice service, I get the following exception.
I am not binding the webservice to any port.
Here is a code snippet:
public Form1()
{
tmp = new TmpConvertProxy.Service();
tmp.ConvertTemperature(100);
InitializeComponent();
}

My IIS is setup so that anonymous access is enable.

Can anyone help
Thanks
Frustrated Chris

System.Net.WebException was unhandled
Message="Unable to connect to the remote server"
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at tfxmlviewer.TmpConvertProxy.Service.ConvertTemperature(Double dFahrenheit) in D:\Documents and Settings\Christian Roy\My Documents\Visual Studio 2005\Projects\tfxmlviewer\Web References\TmpConvertProxy\Reference.cs:line 110
at tfxmlviewer.Form1..ctor() in D:\Documents and Settings\Christian Roy\My Documents\Visual Studio 2005\Projects\tfxmlviewer\Form1.cs:line 29
at tfxmlviewer.Program.Main() in D:\Documents and Settings\Christian Roy\My Documents\Visual Studio 2005\Projects\tfxmlviewer\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()




Answer this question

No connection could be made because the target machine actively refused it

  • prujohn

    first advice is to make sure that the firewall isnt blocking it, so be sure if you specified any ports, to open those ports on your firewall.

    This is one common issue



  • Markgannon

    Thanks for the reply.there is no firewall on this machine but there is a router. Webservice and application resides on the same machine.I did not specify any port either. I would not know how - maybe it would simplify the development once I deploy the webservice on the server.

  • lisaais

    Hello,

    First of all, have you verified that the service is live when you call it A simple check using a browser should suffice. Just browse to the asmx page and verify that you can see the help page.

    Next, have you verified that the addressed used by your client is correct The address is typically picked up from your application configuration file. Make sure that the adderss used by your client and the address you test for liveness are the same.

    Daniel Roth



  • No connection could be made because the target machine actively refused it