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: