Best way to support "application/x-www-form-urlencoded" post data with WCF?

The best way is to use Stream like Raw HTTP POST with WCF or what you are saying. The reason is because WCF abstracts all the communication-level physical layout stuff out from the service code. Ideally, you would want to make a service that could turn into SOAP or REST just by flipping the switch.

To support it natively, you probably have to extend WebHttpBinding or make your own binding and implement custom encoder. This is symmetric to the output like the linked post says. You have to twist its arms to get WCF to output non-XML/JSON stuff.


The WCF REST Contrib library enables this functionality:

https://github.com/mikeobrien/WcfRestContrib

It includes a POX formatter and form url encoded formatter and allows you to easily create your own. Formatters are mapped to mime types and automatically selected to serialize/deserialize the entity body based on the content type and accept headers.