Note that there are some explanatory texts on larger screens.

plurals
  1. POWebHttpBinding in WCF: how to configure it the proper way?
    text
    copied!<p>Trying to follow this example to make it work: <a href="http://weblogs.asp.net/kiyoshi/archive/2008/10/08/wcf-using-webhttpbinding-for-rest-services.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/kiyoshi/archive/2008/10/08/wcf-using-webhttpbinding-for-rest-services.aspx</a></p> <p>Here is my <code>App.config</code>:</p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;!-- The service for the TEST WEB client --&gt; &lt;service name="MyServer.AAServiceType" behaviorConfiguration="Default"&gt; &lt;endpoint address="testservice" binding="webHttpBinding" behaviorConfiguration="webBehavior" contract="MyServer.AAIContractName" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8787/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;!-- TEST WEB BEHAVIOR --&gt; &lt;behavior name="Default"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;!-- TEST WEB ENDPOINT --&gt; &lt;endpointBehaviors&gt; &lt;behavior name="webBehavior"&gt; &lt;webHttp /&gt; &lt;/behavior&gt; &lt;/endpointBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; </code></pre> <p><b>Update:</b> The service contract is:</p> <pre><code>namespace MyServer { [ServiceContract(SessionMode=SessionMode.NotAllowed)] public interface IContractName { [WebGet(UriTemplate = "date/{year}/{month}/{day}", ResponseFormat = WebMessageFormat.Xml)] [OperationContract] string GetDate(string day, string month, string year); } public class ServiceType : IContractName { public string GetDate(string day, string month, string year) { return new DateTime(Convert.ToInt32(year), Convert.ToInt32(month), Convert.ToInt32(day)).ToString("dddd, MMMM dd, yyyy"); } } } </code></pre> <p>The problem is that when I am trying to connect to 8787 port (using <code>putty</code>, for instance) a <em>"Connection refused"</em> error is returned. As you can see, I've also tried to put the wrong names in contract class and service implementation and got no exceptions. What am I doing wrong, please?</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