Creating ASP.NET Web Service

ASP.NET Web Service – Web service is a software that is used to exchange XML-based information that uses the internet to interact with any other application called its client. This software provides a modular method that could be used by multiple applications through the web.

For detailed information about Web Service visit this thread on WIKIPEDIA

See tutorial below on starting your web service application in ASP.NET.

Let’s start:


  • I’m using Visual Studio 2013
  • Net Framework 3.5

Step 1. First start by opening your visual studio and create new Web Site project.

ASP.NET Web Service

Create New Project

Step 2. From new web site window choose .Net Framework 3.5 from the drop down just above your middle pane. See image below.

ASP.NET Web Service

.Net Framework 3.5

Step 3. Choose ASP.NET Web Service from the middle pane and rename your project

ASP.NET Web Service

ASP.NET Web Service

Step 4. The image below is the solution explorer of a newly created website project.

ASP.NET Web Service

Solution Explorer

Step 5. Open Service.cs. This file is your main class that contains your web method that is used for your web service method.


  • [WebMethod] >> this is used as a declaration for the method that should be accessible on the web.
  • This example code returns Hello World string as the output.

This image is the default code generated for a new Web Site project.

ASP.NET Web Service


Step 6. To run project hit F5 on your keyboard to run project in debugging mode or hit CTRL + f5 to run without debugging mode. Your project will display on a browser containing your method HelloWorld().


ASP.NET Web Service

Web Service

Step 7. To test how web service work click on your method and click  invoke button.

ASP.NET Web Service


It should bring you to a new tab containing your return value Hello World. It should look like the image shown below.

ASP.NET Web Service

HelloWorld return value

You have just created your first ASP.NET Web Service project.

You can start adding your method now and consume it in a client side application.

Thank you for reading. Happy coding!!


Post you may like:

[pt_view id=”2384ae03it”]


Leave a Reply

Your email address will not be published. Required fields are marked *