Running a WCF REST Service in IIS 7.5 with No *.svc file

Setting up a WCF RESTful service is extremely easy to do. In fact, you can do this with no *.svc file and no config file. However, you might run into a situation where your service worked fine during development using the Visual Studio web server but when you deploy to IIS 7.5 it no longer works. Specifically, for a simple request like http://localhost/help you get the error: "HTTP Error 404.0 - Not Found. The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." If you ever run into this situation, make sure that you have this in the web.config file:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </modules>
</system.webServer>

The UrlRoutingModule is what matches an incoming HTTP request to a route and therefore allows URI's that don't map to physical files. Otherwise, IIS is looking for a physical file on the file system called "help" (i.e., in the http://localhost/help example above). If you ever run into this issue, save yourself some trouble and make sure this is in your config file.