Previous | Home | Next |
How To make a Web Services (To Calculate Circle area using C#)
Step 1: Start a New Web Site.
Click on ASP.Net Web Services and named your service CircleArea and press on OK.
Step 2: The code written for your application which return area of circle (Service.cs). This service contain a CircleArea method which calculate the area.
using System; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service () { } [WebMethod (Description="To calculate Area of Circle")] public double CircleArea(int a) {return 3.14 * (a * a);} }
Step 3: Run your service.
Click on CircleArea. Service is run and when you input value the result be shown.
If you want to see Service Description. Click on Service Description.
Now Web service is Created.
- If you want to know how to Use this service in Your ASP.Net Application Click Here.
- Click Here how to use in Console Application.
Previous | Home | Next |