You must Sign In to post a response.
  • Category: WCF

    How to build WCF service using both BasicHttp & WebHttp bindings

    Hi,
    Please share, if any body know how to configure two end points BasicHttp & WebHttp bindings in WCF service.
  • #755584
    hI,

    create another endpoint using a different address (two endpoints cannot share the same address). you can modify the existing OperationContract to create the non-RESTful methods.
    HERE THE EXAMPLES ARE THERE FOR USING TWO BINDINGS.

    <system.serviceModel>
    <services>
    <service name="EReportService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour">
    <endpoint address="" binding="webHttpBinding" contract="EReportService.IRestServiceImpl" behaviorConfiguration="web">
    </endpoint>
    <endpoint address="soap" binding="basicHttpBinding" contract="EReportService.IRestServiceImpl" >
    </endpoint>
    </service>
    </services>
    </system.serviceModel

    Hope u understood..

    Thanks,
    chitaranjan

  • #755592
    A service may have multiple endpoints within a single host, The thing is that every endpoint must have a unique combination of address, binding and contract. In other words the combination must be different.


    as per MSDN samples


    <service
    name="Microsoft.ServiceModel.Samples.CalculatorService"
    behaviorConfiguration="CalculatorServiceBehavior">
    <!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->
    <endpoint address=""
    binding="basicHttpBinding"
    contract="Microsoft.ServiceModel.Samples.ICalculator" />
    <!-- secure endpoint exposed at {base address}/secure: http://localhost/servicemodelsamples/service.svc/secure -->
    <endpoint address="secure"
    binding="wsHttpBinding"
    contract="Microsoft.ServiceModel.Samples.ICalculator" />
    ...
    </service>

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #755602
    The end points in my applications are as follows,
    <endpoint address="JSON" binding="webHttpBinding" contract="OnePointAPI.IOnePointAPIService" behaviorConfiguration="web" ></endpoint>
    <endpoint address="XML" binding="basicHttpBinding" contract="OnePointAPI.IOnePointAPIService" ></endpoint>

    Now request(webHttpBinding) with JSON address working fine and getting result pefectly,
    http://localhost/1PointAPI/OnePointAPIService.svc/JSON/GetAllLists/anwar/anwar
    where as when i request(basicHttpBinding) like bellow , i am not getting any response(empty screen)
    http://localhost/1PointAPI/OnePointAPIService.svc/XML/GetAllLists/anwar/anwar


  • Sign In to post your comments