Don’t Create REST APIs with WCF REST Services…use Web API Instead

There was time when developers used to create Web Service using the WCF. Their argument was using basicHttpBinding makes a WCF service as a Web Service. Yes that ASMX based web service. I never agree to this argument. Clearly WCF was an evolvement over ASMX Web Service. Now let us talk about purpose of this…… Continue reading Don’t Create REST APIs with WCF REST Services…use Web API Instead

Data Contract Serialization Events in WCF

In WCF we use the DataContract to serialize and deserialize the custom data. Sometime you may come across a scenario do some work before or after the data gets serialized or deserialized. These are following four events provided on the DataContract. You are free to give any method name provided method should return void and…… Continue reading Data Contract Serialization Events in WCF

Multiple bindings in self-hosted WCF Service

Even though WCF is now, more than 5 years old but still I see developers struggling with the multiple bindings specially when hosted in a managed console application. In this post, step by step we will learn to create a WCF Service with multiple bindings and host the service in a managed console application. We…… Continue reading Multiple bindings in self-hosted WCF Service

Fault Contract’1 was unhandled by user code: Solved

For a training purpose I was trying a basic demo on fault contract in WCF and to be surprised I Got below error while throwing FaultException. It’s not that 1st time I was working on Fault Contract but this error was irritating. After some investigation I found there was some issue in visual studio 2013…… Continue reading Fault Contract’1 was unhandled by user code: Solved

Solved Access-Control-Allow-Origin Error in WCF REST Service

  Recently I was working on a JSON based WCF REST Service. It was a simple service performing CRUD operation. When I tried to consume service from a web based client, got following errors in browser console. Error message was, No Access-Control-Allow-Origin header is present on the required resource. Since service was running on different…… Continue reading Solved Access-Control-Allow-Origin Error in WCF REST Service

Dealing Multiple EndPoints of a WCF Service

If you know EndPoints well, you know WCF well. Configuring EndPoints are vital for any WCF design. You can configure EndPoints either via code or in web.config file. I have seen many times, developers are confused with EndPoints. I have come across following common question about EndPoints Can we have multiple EndPoints? Can be expose…… Continue reading Dealing Multiple EndPoints of a WCF Service

Return type of One-way or Simplex WCF Service

WCF is one of the most asked topics in interviews. Recently one of my reader sent me a mail. He asked, “What is error in following code?” His code snippet was as below, In one sentence, problem with above code is in return type of Operation Contract. IsOneWay property of Operation Contract is set to…… Continue reading Return type of One-way or Simplex WCF Service