Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project for school (I'm in High School), and as a part of my project I need to make a simple Web Service. I have created 2 Web Services which contain just XML files, and then another Web Service, to which I connected the other 2 as Web References.

My problem is:

When using the 3rd Web Service for the first time, everything works correctly, but when I want to use it again, the following message appears:

"System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ShipAll.ShippingCenter1.ListOfShipment()
at ShippingAll.FindShipment(String city)"

The only solution I found so far is to competently delete the Web References and add them again, with the new address (localhost:... with a new port...)
I've tried to make the port static instead of dynamic, so that the port number will not change and thus the localhost:... address will not change either. But that didn't help me.

I've searched a lot and I have no idea what to do...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900