Answered by:
No connection could be made because the target machine actively refused it 127.0.0.1:8201

Question
-
User411771660 posted
My project is asp.net webforms application.It was working fine a while ago from my machine.I am getting this error when i am invoking this method.It breaks at var responseString.
public static string SendSMS(string from, string token, string url, string to, string text) { using (var client = new WebClient()) { string parameters = "?"; parameters += "from=" + from; parameters += "&to=" + to; parameters += "&text=" + text; parameters += "&token=" + token; var responseString = client.DownloadString(url + parameters); return responseString; } }
Everything was working fine and it still works fine on a different machine not on mine.I tried searching everywhere and followed the advice.My firewall is off.There is no proxy.I even tried to allow port 8201 still getting the same error.Restarted IIS,Rebuilt the solution.Did everthing.Couldnt get hold of this.One answer suggested with corrupt host file entry.Yes i did added some entries to it few days ago but today i did resetted the host file to the default settings and still getting the error.
StackTrace : [SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:8201]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +185
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +506
[WebException: Unable to connect to the remote server] System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +283 System.Net.WebClient.DownloadString(Uri address) +100
System.Net.WebClient.DownloadString(String address)
+30 Everest.Net.BusinessLayer.SMS.smsParameters.SendSMS(String from, String token, String url, String to, String text) in D:\Everest_PES\Everest.Net.BusinessLayer\SMS\smsParameters.cs:86Help Please
Friday, March 30, 2018 11:30 AM
Answers
-
User475983607 posted
By service you mean PostgreSQL service sir?
The code is trying to send an HTTP request to 127.0.0.7:8201. 127.0.0.7 is your localhost and the service is running on port 8201. I can't see your source code or machine and have no idea how the service is hosted. I assume you had a hand in building the application and therefore know what service is running on 127.0.0.7:8201. After all it is your machine. If not perhaps there is a team member that can help you understand how the application works.
Again, simply verify the service is up and running, maybe use your browser...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 30, 2018 11:48 AM -
User1120430333 posted
I am sending a request to a third party API to send sms sir
Well, either the API is not up and running or something like a firewall in blocking the traffic to the API. But the 127.0.0.1 that you have posted about is the loopback IP that means that no traffic is leaving the computer and the traffic is being looped back to the machine.
https://www.lifewire.com/network-computer-special-ip-address-818385
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 30, 2018 3:34 PM
All replies
-
User475983607 posted
The error commonly means the service is not running. Have you verified the service is running on localhost?
Friday, March 30, 2018 11:33 AM -
User411771660 posted
By service you mean PostgreSQL service sir?
Friday, March 30, 2018 11:36 AM -
User475983607 posted
By service you mean PostgreSQL service sir?
The code is trying to send an HTTP request to 127.0.0.7:8201. 127.0.0.7 is your localhost and the service is running on port 8201. I can't see your source code or machine and have no idea how the service is hosted. I assume you had a hand in building the application and therefore know what service is running on 127.0.0.7:8201. After all it is your machine. If not perhaps there is a team member that can help you understand how the application works.
Again, simply verify the service is up and running, maybe use your browser...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 30, 2018 11:48 AM -
User411771660 posted
I am sending a request to a third party API to send sms sir
Friday, March 30, 2018 11:57 AM -
User1120430333 posted
I am sending a request to a third party API to send sms sir
Well, either the API is not up and running or something like a firewall in blocking the traffic to the API. But the 127.0.0.1 that you have posted about is the loopback IP that means that no traffic is leaving the computer and the traffic is being looped back to the machine.
https://www.lifewire.com/network-computer-special-ip-address-818385
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 30, 2018 3:34 PM