Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does my WCF service not respond my baseAddress setting in web.config?
    text
    copied!<p>I'm trying to learn how to build RESTful services with WCF by recreating the project on <a href="http://blogs.conchango.com/anthonysteele/archive/2008/03/15/rest-from-wcf-3-5.aspx" rel="nofollow noreferrer">this blog post</a> by Anthony Steele. He uses the following XML in his config to setup the endpoint for the service.</p> <pre><code> &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8080/greeter"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; </code></pre> <p>However, when I try to do the same thing in my ASP.NET 3.5 web site's web.config, I am unable to navigate to my service. Here is the XML I'm using:</p> <pre><code>&lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="GreeterBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;services&gt; &lt;service behaviorConfiguration="GreeterBehavior" name="Greeter"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:49268/TestREST/webapi/services/greeter"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="IGreeter"&gt; &lt;identity&gt; &lt;dns value="localhost"/&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;/system.serviceModel&gt; </code></pre> <p>I would imagine my configuration would allow me to navigate to <a href="http://localhost:49268/TestREST/webapi/services/greeter" rel="nofollow noreferrer">http://localhost:49268/TestREST/webapi/services/greeter</a> and see my service. All I get is a resource not found message - am I missing something?</p> <p>Edit: Part of my problem was my binding was wsHttpBinding. Using webHttpBinding allowed me to use the service correctly - except, the baseAddress config section still has no effect.</p>
 

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