Powered by Blogger.

Sunday, March 2, 2014

System.InvalidOperationException:Cannot have two operations in the same contract with the same name




This error comes when i do method overloading in WCF in C#.Net. When i implement two method having same name in WCF I get an error "System.InvalidOperationException:Cannot have two operations in the same contract with the same name".

So to solve this error we have to implement these two method Using NAME paramerter like below.

[ServiceContract]
    public interface IService1
    {

        [OperationContract(Name="ShowIntegerData")]
        string DisplayData(int value);

        [OperationContract(Name="ShowStringData")]
        string DisplayData(string value);      
    }



0 comments

Post a Comment