Posts
203
Comments
1119
Trackbacks
51
December 2010 Entries
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:

   1:  <system.webServer>
   2:    <modules runAllManagedModulesForAllRequests="true">
   3:      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   4:    </modules>
   5:  </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.

Posted On Wednesday, December 1, 2010 12:30 AM | Comments (3)

View Steve Michelotti's profile on LinkedIn

profile for Steve Michelotti at Stack Overflow, Q&A for professional and enthusiast programmers




Google My Blog

Tag Cloud