Archive for the ‘Categories’ Category

Exception – Cannot have two operations in the same contract with the same name, methods GetDataForTeacher and GetDataForStudent in type WcfSample.IStock violate this rule. You can change the name of one of the operations by changing the method name or by using the Name property of OperationContractAttribute

When I got this exception while using same Name,was wondering what is the role of Name parameter,Methods are implemented with two different names & why is it throwing this exception for the below contract.

public interface IStock

[OperationContract(Name ="GetData")]
string GetDataForTeacher(int value);
[OperationContract(Name ="GetData")]
string GetDataForStudent(int value);


First lesson learnt,do not use anything by simply copy pasting :)Understand the purpose & if it is required then only use it.

Now let me come to the point what does this Name property do?Name has to be specified when you need to override the element name in to override the name of methods GetDataForTeacher & GetDataForStudent in wsdl.When you specify Name,now what has happend is it reads as two methods with name GetData.Ideally,Name should be specified only in cases where you have the same implementing method names(overloading scenario) as shown below.

public interface IStock

[OperationContract(Name ="GetDataForTeacher")]
string GetData(int value);
[OperationContract(Name ="GetDataForStudent")]
string GetData(string value);



WCF useful links

Posted: December 5, 2010 in Categories, WCF
Tags: , ,

WCF Architecture Overview –

WCF Getting Started –

WCF 3.5 samples –

WCF 4.0 samples –

Net endpoint blog (Blog by the .NET and AppFabric teams about WCF and WF development, deployment, and management) –

WCF REST Starter Kit –

WCF Forum –

WCF Test Client – (WcfTestClient.exe)


It’s been few months since I have started working with wcf services &  I have already talked about the same topic, way to test wcf services in linkedin.I thought this is the best place to share it once again.

For testing WCF services,there is a tool that microsoft ships with visual studio called WCF Test Client(WcfTestClient.exe)

This can be found at the following location

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\
More details on this can be found at .

A limitation I found with this is,only Soap endpoints which can expose metadata about itself (WSDL or Mex) can be invoked using this.

For Wcf REST services,One alternative you can try is to create the test client yourself in code using the ChannelFactory<T> class using the same contract used in the service(You will have to manually write a proxy as svcutil.exe do not support automatic proxy generation for REST services). Then use some network capture tool such as Fiddler ( to send requests to the service.

Though not all WCF tools are free,here are a few which you can try out.I have tried out SOAP Ui & SOA Cleaner for my services & seems to be good.

SoapUI can be found at :

SOA Cleaner can be found at:

WCFStorm can be found at: 

One more useful way for developers to unit test WCF methods is to right click & generate test method.More details on this is available here

Hope you find this information useful.If you have come across any other ways to test WCF services,please share.