How to create ASP.NET Web Services?
For creating of Web Services follow the following Steps:-
Step(1):- Open VS--->File-->New-->Project-->Select .Net Framework 3.5 version in drop down list-->Select Web in left hand side--> Select ASP.NET Web Service Application-->Give Name as you want-->Click on OK button.
Step(2):- When you click on OK button then you see following screen.
Step(3):- Now, we added new methods as our requirement as shown in below:-
Step(4)Now, built the solution and run. After run we can see following image.
Step(4)When we click on Addition method we can seen 2 Textboxes and 1 Invoke button. Now we put values in both Text boxes and click on Invoke button then get output in xml format as shown in below.
Step(1):- Open VS--->File-->New-->Project-->Select .Net Framework 3.5 version in drop down list-->Select Web in left hand side--> Select ASP.NET Web Service Application-->Give Name as you want-->Click on OK button.

Step(2):- When you click on OK button then you see following screen.

Step(3):- Now, we added new methods as our requirement as shown in below:-
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace CalculatorWebServices { /// /// Summary description for Service1 /// [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 Service1 : System.Web.Services.WebService { [WebMethod] public string WebServiceDemo() { return "This is Calculator Web Services Demo By Santosh Kumar Singh"; } [WebMethod] public int Addition(int a, int b) { return a + b; } [WebMethod] public int Subtration(int a, int b) { return a - b; } [WebMethod] public int Multiplication(int a, int b) { return a * b; } [WebMethod] public int Devision(int a, int b) { return a / b; } } }
Step(4)Now, built the solution and run. After run we can see following image.

Step(4)When we click on Addition method we can seen 2 Textboxes and 1 Invoke button. Now we put values in both Text boxes and click on Invoke button then get output in xml format as shown in below.
![]() |
![]() |
![]() |