using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
This is code from my Consumer app. It doesn't like "local host" - could not be found. Can you help?
class Program
{
static void Main(string[] args)
{
localhost.Service1 myMathService = new localhost.Service1();
Console.Write("2 + 4 = {0}", myMathService.Add(2, 4));
}
}
}
*************************************************** Producer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace MathService
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public int Add(int a, int b)
{
return (a + b);
}
[WebMethod]
public System.Single Subtract(System.Single A, System.Single B)
{
return (A - B);
}
[WebMethod]
public System.Single Multiply(System.Single A, System.Single B)
{
return A * B;
}
[WebMethod]
public System.Single Divide(System.Single A, System.Single B)
{
if (B == 0)
return -1;
return Convert.ToSingle(A / B);
}
}
}