Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am runnig this application on windows 10.

What I have tried:

i Just created a simple "Empty ASP.Net web application" and added a web services named as "HelloWebService.asmx" within this file created a single method called as "GetMessage" with single parameter as follows:
public class HelloWebServices : System.Web.Services.WebService
    {
        [WebMethod]
        public string Getmessage( string name)
        {
            return "Hello World " + name;
        }
    }

After that i created one more "Empty ASP.NET Web Application" with the name "HelloWebClient" and added to this a "WebForm1.aspx" with the following code to call the "Getmessage" web method in the "HelloWebServices".
public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Button1_Click(object sender, EventArgs e)
        {
            HelloWebService.HelloWebServicesSoapClient client = new 
            HelloWebService.HelloWebServicesSoapClient();

            Label1.Text = client.Getmessage(TextBox1.Text);
        }
    }  

After that, i add a ServiceReference "HellowWebservice" to the "HelloWebClient".

Now i am running the application and click on the "Get Message" button and i am getting the below error. please advise and help me to solve this issue.

The exact error is in the line : 120 return base.Channel.Getmessage(request);
Server Error in '/' Application.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:51537

Source Error:

Line 118:        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
Line 119:        helloWebClient.HelloWebService.GetmessageResponse helloWebClient.HelloWebService.HelloWebServicesSoap.Getmessage(helloWebClient.HelloWebService.GetmessageRequest request) {
Line 120:            return base.Channel.Getmessage(request);
Line 121:        }
Line 122:        
Posted
Updated 21-Jan-20 17:35pm
Comments
j snooze 30-Jun-17 17:27pm    
either a firewall issue or the following might help.

https://stackoverflow.com/questions/28346177/no-connection-could-be-made-because-the-target-machine-actively-refused-it-127-0

1 solution

Check your .config files, mostly this error is caused by a wrong port number, or incorrect name of the PC (which should be localhost if you are testing everything on one PC).
 
Share this answer
 

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