This example demonstrates how easy it can be to create a web service.
1. Create a directory with any name, say "TestDir".
2. Create a virtual directory named "TestWeb" pointing to "TestDir.
3. Create a file as follow with your notepad named "Hello.asmx" in "TestDir".
<%@ WebService Language="C#" class="HelloClass" %>
using System;
using System.Web;
using System.Web.Services;
public class HelloClass
{
[WebMethod]
public String GetGreeting()
{
return "Hello!";
}
}
That's all you need to do. To test it, open a web page and key in URL "http://localhost/TestWeb/Hello.asmx".