You want to create a web service.
Use Visual Studio to create a new web service and then add methods to expose the functionality required for your web service.
To create the new web service:
On the Visual Studio .NET File menu, choose New→ Project....
When the New Project dialog box is displayed, go to the left pane and select either Visual Basic Projects or Visual C# Projects.
Go to the right pane and click on the ASP.NET Web Service icon.
Enter the name of the web service in the Location text box and click OK.
Visual Studio .NET creates a virtual directory in IIS and a project
that contains a
.asmx file and code-behind files
for the web service, like those shown in Example 11-2 through Example 11-5. The web
service is fully functional at this point but is just a shell with no
You need to add methods to the code-behind to expose the functionality required for your web service. The code-behind shown in Example 11-6 (VB) and Example 11-7 (C#) shows a method we have added to our example web service to return a list of books from a database. The code generated by Visual Studio .NET to support the component designer has been omitted from Example 11-6 and Example 11-7 for clarity.
You can add a web service to an existing web application by selecting the project in the Solution Explorer, and then selecting Add New Item from the File menu. When the Add New Item dialog box is displayed, select Web Service, enter the desired name ...