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:

SOLVED: An unexpected error occurred in the .NET Framework Data Provider for MySQL

If you are here I’m expecting that you encountered same problem as mine. I was transferring a DataSet file to ...
Read More

How to create custom 404 error handler in ASP.NET MVC

Custom 404 error handler - 404 Error refer to a not found resource/URL . Here’s how a default 404 Error ...
Read More

AngularJS CRUD Operation using ASP.NET MVC

I am a .NET Developer and I’m new in AngularJS. I started using AngularJS in about a week ago and ...
Read More
SignalR Chat App With ASP.NET

SignalR Chat Application with ASP.NET MVC

SignalR Chat App With ASP.NET - This article will show you an actual application using SignalR in ASP.NET MVC. The ...
Read More

Submit Forms using AgularJS with ASP.NET MVC

Ways on how to submit forms using AngularJS: I’m new to AngularJS and I was trying to create a CRUD application ...
Read More
Self Signed Certificate

How: Creating Self Signed Certificate

As defined in A self-signed certificate is a certificate that is signed by the person creating it rather than a trusted ...
Read More

AngularJS with Asp.Net MVC

What is Angular? AngularJS is a JavaScript framework that extends HTML attribute to help develop a dynamic Web application. AngularJS ...
Read More

Importing Excel with ASP.NET MVC

Importing excel, In my previous article, I demonstrated how to perform simple way of downloading data into excels. Now, this ...
Read More

Export Data to Excel with ASP.NET MVC

In creating a system there are times that we need to export data to excel, it could either be for ...
Read More

Easy Steps to Implement Partial View in Asp.Net MVC

One of the best ways to implement a dynamic table without loading the whole page is by using Jquery Ajax ...
Read More


Leave a Reply

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