Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bare Minimum Configuration for RESTful WCF

What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.

like image 691
kgriffs Avatar asked Sep 26 '08 14:09

kgriffs


1 Answers

I discovered that you can add the following to the ServiceHost directive in the *.svc file, and it will automatically setup WebHttpBinding and WebHttpBehavior for you:

Factory="System.ServiceModel.Activation.WebServiceHostFactory"

Note that the namespace is a little different from what is mentioned elsewhere on the web (such as in this MSDN article).

After doing this, I was able to delete the entire section from web.config and everything still worked!

like image 74
kgriffs Avatar answered Sep 18 '22 17:09

kgriffs