How to create an ASP.NET Web Service using Visual Studio?


My previous post I’ve described about Web Services, Web Services Components and Benefits of Web Services. Here I’m going to demonstrate about ‘How to create an ASP.NET Web Service using Visual Studio?’.

Important Note: .NET Framework3.5 and lower versions only support Classic ASP.NET Web Service Templates because ASP.NET 4, Visual Studio 2010 and later versions are started to support on WCF and RESTful Services.

If you are using Visual Studio2010, then you have to change the Framework version 4 to 3.5 to select the ASP.NET Web Service application template.

  1. Select ‘ASP.NET Web Service Application Template’

Steps to follow:

  • Start Visual Studio
  • Click ‘File’ menu
  • Select sub menu ‘New’, In ‘New’ select ‘Project’ (Shot cut key > Ctrl + Shift +N)
Select ASP.NET Web Service Application Template

Select ASP.NET Web Service Application Template

2. Service Naming Convention

You should consider the naming convention for your new service. If you’re going to convert your service to API and it can be consumed by many clients, so naming is very very important to understand the purpose of service.

Syntax:   <Part1> <Part2><Part3>

Part1 – Prefix, it could be ‘Secure’ or ‘ws’ or ‘your project short term’

Part2 – Pupose of service

Par3 – Suffix ‘Service’

e.g., If you are going to create a Billing related service then it could be SecureBillingService OR wsBillingService OR ABCBillingService OR HMSBillingService

Here Secure, ws, ABC(CompanyName), HMS(Product Name) are kind of prefixes.

Web Service Naming Conventions

Web Service Naming Conventions

Advertisements