1
Reply

How to make a class accessible as a web service?

    By making the class inherits from the System.Web.Services.WebService class.

    By qualifying the class with the WebService attribute 

    Inheriting from the WebService class is beneficiary in that it allows the class to access the ASP.NET context and other useful objects such as the session and application objects. On the other hand, qualifying the class with the WebService attribute allows for setting additional properties of the web service such as its description and namespace.

    C#
        [WebService]
       
    public class TestService : System.Web.Services.WebService

    VB
       
    <WebService> _
       
    Public Class TestService
           
    Inherits System.Web.Services.WebService