[WCF]How to expose WCF service to .NET 2.0 client

[WCF]How to expose WCF service to .NET 2.0 client

WCF is provided in .NET 3.0 and much enhanced in 3.5. However, sometimes we still need to consume WCF service in .NET 2.0 applications. For such cases, it is very important that how we implement and host the WCF service. Here are some info about how to make our WCF service consumable by .NET 2.0 client(webservice client or plain http client):

1. Webservice Client

WCF support many different kind of bindings and behaviors, only a few of them are compatible with ASP.NET webservice based client. To make our WCF service consumable by webservice client, we should use those webservice friendly configuration. For example, use basicHttpBinding, do not use WCF message layer security or some other WCF specific features. The following msdn reference gives a general overview on this:

#Interoperability with ASP.NET Web Services

https://msdn.microsoft.com/en-us/library/ms731779.aspx

#How to: Configure WCF Service to Interoperate with ASP.NET Web Service Clients

https://msdn.microsoft.com/en-us/library/ms731134.aspx

2. Plain HTTP Client

In .NET 3.5, WCF is further enhanced, one cool feature is web based endpoint. This web based endpoint makes client convenient to use http component(.NET WebRequest classes or even web page client script) to consume WCF service and can let WCF service easily return custom format data. For detailed info on WCF web programming, please refer to the following content:

#Web Programming Model

https://msdn.microsoft.com/en-us/library/bb412169.aspx

#Creating a JSON Service with WebGet and WCF 3.5

https://blogs.msdn.com/kaevans/archive/2007/09/04/creating-a-json-service-with-webget-and-wcf-3-5.aspx