By making the class inherits from the System.Web.Services.WebService class.
System.Web.Services.WebService
By qualifying the class with the WebService attribute
WebService
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