Replace WCF default JSON serialization

You can use a message formatter to change the serializer used to deal with JSON. The post at https://learn.microsoft.com/en-us/archive/blogs/carlosfigueira/wcf-extensibility-message-formatters shows an example on how to change the default serializer (DataContractJsonSerializer) to another one (JSON.NET).

Web Service vs WCF Service

This answer is based on an article that no longer exists: Summary of article: “Basically, WCF is a service layer that allows you to build applications that can communicate using a variety of communication mechanisms. With it, you can communicate using Peer to Peer, Named Pipes, Web Services and so on. You can’t compare them … Read more

Increasing the timeout value in a WCF service

Are you referring to the server side or the client side? For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent. <system.serviceModel> <bindings> <netTcpBinding> <binding name=”longTimeoutBinding” receiveTimeout=”00:10:00″ sendTimeout=”00:10:00″> <security mode=”None”/> </binding> </netTcpBinding> </bindings> <services> <service … Read more

Run WCF ServiceHost with multiple contracts

You need to implement both services (interfaces) in the same class. servicehost = new ServiceHost(typeof(WcfEntryPoint)); servicehost.Open(); public class WcfEntryPoint : IMyService1, IMyService2 { #region IMyService1 #endregion #region IMyService2 #endregion } FYI: I frequently use partial classes to make my host class code easier to read: // WcfEntryPoint.IMyService1.cs public partial class WcfEntryPoint : IMyService1 { // … Read more

How to remove the “.svc” extension in RESTful WCF service?

I know this post is a bit old now, but if you happen to be using .NET 4, you should look at using URL Routing (introduced in MVC, but brought into core ASP.NET). In your app start (global.asax), just have the following route configuration line to setup the default route: RouteTable.Routes.Add(new ServiceRoute(“mysvc”, new WebServiceHostFactory(), typeof(MyServiceClass))); … Read more