Posts
208
Comments
1144
Trackbacks
51
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 Print
Comments
Gravatar
# re: Running a WCF REST Service in IIS 7.5 with No *.svc file
maor
9/20/2011 6:01 AM
i like you .......tnks for that .
Gravatar
# re: Running a WCF REST Service in IIS 7.5 with No *.svc file
ATIF
9/5/2012 10:15 AM
hI iam Atif iam using third party REST inside Silverlight it works preety well when i run inside localhost but when i host this application on my static IP IIS so it does not work even i used the web config changes which you showed above kindly help me what iam missing when i check with fiddler so it says 404 error clientaccesspolicy file missing.
Gravatar
# re: Running a WCF REST Service in IIS 7.5 with No *.svc file
Steve Michelotti
9/9/2012 2:14 PM
@ATIF - For Silverlight, make sure you take this into account: http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx

Post Comment

Title *
Name *
Email
Comment *  
Verification

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