RESTful Services in Visual C# 2008
Here’s a problem that had me scratching my head for a while this weekend. How do I create a simple REST service using WCF (Windows Communication Foundation)?
MSDN has a great little tutorial that explains how to code the service and get it running in a standalone application context. However, it fails to address getting the service deployed on an IIS server.
The key point that seems to be missing from the documentation is that no matter
what you do with the web.config file, you’re never going to get a configuration
that works as a plain-old REST web service. Instead, you have to delete the web
service configuration completely from the web.config file, and add the
the ServiceHost element in the .svc file associated with your service.
Here’s a quick and dirty example:
That’s actually quite easy really, isn’t it? If only the MSDN docs told you that..