I am creating a simple asmx web service and trying to consume them. Below is the asmx web service
public class AddTwoNumbers : System.Web.Services.WebService
{
[WebMethod]
public int GetSum(int a, int b)
{
return a + b;
}
}
This is the Windows Console application where I am consuming the service that was created
namespace TestASMXService
{
class Program
{
static void Main(string[] args)
{
AddingNumber.AddTwoNumbers add = new AddingNumber.AddTwoNumbers();
Console.Write("First Number:");
int firstNum = Convert.ToInt32(Console.ReadLine());
Console.Write("Second Number:");
int secNum = Convert.ToInt32(Console.ReadLine());
Console.Write ("The Sum is:",add.GetSum(firstNum, secNum));
Console.ReadLine();
}
}
It receives the user inputs and does not return any result or throws any error
Can anyone please tell me what I am missing here.
GetSum
call and see where it's blocking - I suspect it's blocking on getting the response. Are you running any firewall software that's blocking local-loopback connections? – Dai