Multiple choice

What attribute must mark the methods exposed by a Web Service?

  1. Web Service Method ()

  2. Web Method ()

  3. Web Services ()

  4. Services Method ()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In .NET ASMX web services, methods must be marked with the [WebMethod] attribute to be exposed as callable web service operations. This attribute enables the method to be invoked via SOAP/HTTP requests. Without it, the method remains internal to the class.