c# - Expose webHttpBinding endpoint in a WCF service -
I created a WCF service and highlighted three endpoints which are basic HttpBinding, wsHttpBinding and webHttpBinding. This is a test service for my experiments with WCF, but whenever I add a service reference using the .svc file, I only get two (basic and ws) endpoint, it does not seem that the third reason ( WebHttpBidning) The endpoint is exposed for some reason.
To regenerate this problem, create a WCF application project, delete Service1 service, add new item> WCF service name TestService, and change config file to:
& lt; System.serviceModel & gt; & Lt; Services & gt; & Lt; Service name = "WcfTestService.TestService" behavioral review = "Test service service" & gt; & Lt; Host & gt; & Lt; BaseAddresses & gt; & Lt; AddAddress = "http: //localhost/WcfTestService/TestService.svc" / & gt; & Lt; / BaseAddresses & gt; & Lt; / Host & gt; & Lt; Endpoint address = "original" binding = "basic HttpBinding" contract = "WcfTestService.itestService" /> & Lt; Endpoint address = "ws" binding = "wsHttpBinding" contract = "WcfTestService.itestService" /> & Lt; Endpoint address = "web" binding = "web html binding" contract = "wcftest service. ITest service" / & gt; & Lt; Endpoint address = "Max" binding = "MaxHttpending" contract = "IMAXADEXXchange" /> & Lt; / Services & gt; & Lt; / Services & gt; & Lt; Behavior & gt; & Lt; ServiceBehaviors & gt; & Lt; Behavior Name = "Test Service Service" & gt; & Lt; ServiceMetadata httpGetEnabled = "true" /> & Lt; / Behavior & gt; & Lt; / ServiceBehaviors & gt; & Lt; Endpoint beehaviors & gt; & Lt; Transaction name = "webbavic" & gt; & Lt; WebHttp / & gt; & Lt; / Behavior & gt; & Lt; / EndpointBehaviors & gt; & Lt; / Behavior & gt; Here is the code for ITestService.cs: [Service Editing] Public Interface ITeService Service [[Operation Contract] [Webinvoc]
Boolean Valid User User user); } [DataContract] Public class user {[Datamember (name = "name")] Public string username {get; Set; } [Datamember] public string password {get; Set; }}
and for TestService.svc
public class TestService: ITestService {public bool ValidateUser (user user) {if (user.UserName == "User" & amp; user password == "123") {return true; } return false; }}
I tried different combinations of webinvec parameter and webgate parameters, but failed.
Can anyone tell me why the third end point is not visible in the WSDL file?
@decyclone: I've uncovered webHttpBindings without any problems.
I can see the web binding highlighting in the WCF Test client.
These are my configurations
> pre & lt; Services & gt; & Lt; Service transaction support = "TestWeb.Service2Behavior" name = "TestWeb.Service2" & gt; & Lt; Endpoint address = "" binding = "wsHttpBinding" contract = "TestWeb.Service2" & gt; & Lt; Identity & gt; & Lt; Dns value = "localhost" /> & Lt; / Identification & gt; & Lt; / Endpoint & gt; & Lt; Endpoint address = "web" binding = "web htmlbinding" contract = "test web service 2" & gt; & Lt; / Endpoint & gt; & Lt; Endpoint address = "Max" binding = "MaxHttpending" contract = "IMAXADEXXchange" /> & Lt; / Services & gt; & Lt; / Services & gt;
To make a note here, this work is fine, using VS2008 with Framework 3.5, with the framework 3.5 of VS2010, when I use VS2010 and Framework 4.0, So I'm a WebHT banding WCF Test client, though I can use that billing to post http in all cases.
I think that in Framework 4.0 it is not visible by default, even I try to enable endpoint disclosure, but there is still no luck!
I have covered this behavior in my
Comments
Post a Comment