WebHttpBinding does not reach the client

I created a web service for which I am trying to provide 3 endpoints with different bindings. 1. basicHttpBinding, 2. wsHttpBinding, 3. webHttpBinding

When I make a service reference, I only get endpoints with the created basicHttpBinding and wsHttpBinding bindings. I do not get webHttpBinding. What could be wrong.

Here is the structure of the Model node service in web.config.

<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/> </diagnostics> <services> <service behaviorConfiguration="VersionTolerance.Service1Behavior" name="BookShop.BookShopService"> <endpoint address="sadha" binding="basicHttpBinding" contract="BookShop.IBookShopService" /> <endpoint address="ws" binding="wsHttpBinding" contract="BookShop.IBookShopService" > </endpoint> <endpoint address="web" binding="webHttpBinding" behaviorConfiguration="webHttpBehavior" contract="BookShop.IBookShopService" /> <host> <baseAddresses> <add baseAddress="http://localhost:49654/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="VersionTolerance.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="webHttpBehavior"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> 

+4
source share
1 answer

There is nothing wrong with how it works!

wsHttpBinding and wsHttpBinding are SOAP bindings that display metadata about their service β€” your Visual Studio Add Service Reference can poll its endpoints, find out what they called, what methods they offer, what data types they expect as parameters and what they return.

webHttpBinding is REST - and REST by default has no concept of metadata - you will not get a description of the service, a list of methods, etc. - REST is all resources - not methods.

So, when you do the Add Service Reference , you get proxies for the SOAP endpoints, but not for the REST / webHttpBinding . It works as intended.

WCF data services built on top of REST offer a similar experience with SOAP bindings, since you can make an Add Service Reference and get a good proxy server on the client side and that’s all - from the moment the OData protocol defines metadata exchange over REST. Therefore, if you can include the REST service in the WCF data service, you will be fine.

Otherwise, with REST, you just need to β€œknow” (from the documentation page or something else) what a resource URI is for your REST service, and what HTTP verbs do in your REST context.

+10
source

Source: https://habr.com/ru/post/1336083/


All Articles