1

I'm trying to create a RESTful WCF service. I get a runtime error saying you can't have 2 of the same method names in your service class:

    [OperationContract, WebGet]
    ...
    string Get();

    [OperationContract, WebGet]
    ...
    string Get(int id);

Why in the world can't you! they are both different signatures. If I'm to get this to work like REST like I want, which is to be able to overload stuff like this, then that would suck and WCF is not for me.

Has anyone been able to have 2 of the same method names in your so-called attempt to make WCF restful?

PositiveGuy
  • 46,620
  • 110
  • 305
  • 471

1 Answers1

3

you can override service method by using OperationContract name property with define separate routes.Your service interface should look like

    [OperationContract(Name = "GetemployeeName")]
    string Get(string param);


    [OperationContract(Name = "GetemployeeAge")]
    bool Get(long sysID);
Sanjay Rabadiya
  • 478
  • 5
  • 10