Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does this simple RESTful WCF Service fail with a 404 error?
    primarykey
    data
    text
    <p>Using this tutorial:</p> <p><a href="http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide" rel="nofollow">http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide</a></p> <p>I can get a Directory Listing to display when I run the app from VS 2010.</p> <p>I can paste the URL that is displayed in the IE Browser that VS invokes (http://localhost:4841/) into an outside-of-VS instance of IE and see the same thing. However, if I append "/xml/123" or "/json/123" as shown in the tutorial, so that the URI is "http://localhost:4841/xml/123" or "http://localhost:4841/json/123", I get:</p> <h2>*Server Error in '/' Application.</h2> <p>The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. </p> <h2>Requested URL: /json/123/</h2> <p>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272* </p> <p>If I append "RestServiceImpl.svc" to the URI, so that it is "http://localhost:4841/RestServiceImpl.svc" I get the "Service" page ("This is a Windows© Communication Foundation service. Metadata publishing for this service is currently disabled."); but appending "/xml/123" or "/json/123" leads to the same 404.</p> <p>The most pertinent code (taken straight from the 5-star tutorial) is:</p> <pre><code>[ServiceContract] public interface IRestServiceImpl { [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "xml/{id}")] string XMLData(string id); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/{id}")] string JSONData(string id); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload