Note that there are some explanatory texts on larger screens.

plurals
  1. POExpose webHttpBinding endpoint in a WCF service
    primarykey
    data
    text
    <p>I created a WCF service and exposed three endpoints which are basicHttpBinding, wsHttpBinding and webHttpBinding. This is a test service for my experiments with WCF. But, whenever I add service reference using the .svc file, I only get two (basic and ws) endpoints. There doesn't seem to be a third (webHttpBidning) endpoint being exposed for some reason.</p> <p>To reproduce this issue, create a WCF application project, delete the Service1 service, add new item > WCF service named TestService, and change the config file to the following :</p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WcfTestService.TestService" behaviorConfiguration="TestServiceBehavior"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost/WcfTestService/TestService.svc"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="basic" binding="basicHttpBinding" contract="WcfTestService.ITestService" /&gt; &lt;endpoint address="ws" binding="wsHttpBinding" contract="WcfTestService.ITestService" /&gt; &lt;endpoint address="web" binding="webHttpBinding" contract="WcfTestService.ITestService" /&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="TestServiceBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;endpointBehaviors&gt; &lt;behavior name="webBehavior"&gt; &lt;webHttp /&gt; &lt;/behavior&gt; &lt;/endpointBehaviors&gt; &lt;/behaviors&gt; </code></pre> <p></p> <p>Here is the code for ITestService.cs:</p> <pre><code>[ServiceContract] public interface ITestService { [OperationContract] [WebInvoke] Boolean ValidateUser(User user); } [DataContract] public class User { [DataMember(Name = "Name")] public String UserName { get; set; } [DataMember] public String Password { get; set; } } </code></pre> <p>and for TestService.svc</p> <pre><code>public class TestService : ITestService { public bool ValidateUser(User user) { if (user.UserName == "User" &amp;&amp; user.Password == "123") { return true; } return false; } } </code></pre> <p>I tried different combination of WebInvoke parameters and WebGet parameters, but failed.</p> <p>Can anyone tell me why the third endpoint is not showing up in the WSDL file?</p>
    singulars
    1. This table or related slice is empty.
    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