I want to access all the methods exposed in the service through the URL. if suppose the URL will be :
http://localhost/MyService/MyService.svc
You call it with a /functionname, eg:
http://localhost/MyService/MyService.svc/GetVersionNumber
Edit:
How do you configure your method in the WCF service so you can call it directly from the browser?
I have an Interface:
[ServiceContract]
public interface IWebServiceImpl
{
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "GetVersionNumber")]
string GetVersionNumber();
And a class to implement the GetVersionNumber
method in the Interface:
public class WebServiceImpl
{
public string GetVersionNumber()
{
return "1.0.0.0"; //In real life this isn't hard-coded
}
}
Finally here is the Web.config configuration: