Professional Documents
Culture Documents
1. Open Visual Studio and create a new ASP.NET Web Service Application project.
2. In the Solution Explorer, right-click on the project and select "Add" -> "Web
Service". Name it as "AdditionService".
3. In the code-behind file for the Web Service (AdditionService.asmx.cs), add the
following code to define the addition method:
using System;
using System.Web.Services;
namespace AdditionService
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class AdditionService : System.Web.Services.WebService
{
[WebMethod]
public int Add(int a, int b)
{
return a + b;
}
}
}
namespace AdditionClient
{
public partial class AdditionForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = result.ToString();
}
}
}
10. Build and run the ASP.NET Web Application project. The result of the addition
should be displayed in a label on the Web Form.