Let your WCF Service Support the webget attribute

Source: Internet
Author: User

It's nice to look at the combination of the WCF Service and Web requests, but I cannot configure it myself (no web host is used). So I studied the configuration of the WCF binding.

    1. The binding of endpoint must be webhttpbinding.
    2. Add webhttp.

The sample configuration file is as follows:

<?XML
Version="1.0"
Encoding="UTF-8"?>

<Configuration>

<System. Web>

<Compilation
Debug="True"/>

</System. Web>

<! --When deploying the service library project, the content of the config file must be added to the host's

App. config file. system. configuration does not support config files for libraries.-->

<System. servicemodel>

<Services>

<Service
Name="Services. playerservice"
Behaviorconfiguration="BH">

<Host>

<Baseaddresses>

<Add
Baseaddress="Http: // localhost: 8731/playerservice/"/>

</Baseaddresses>

</Host>

<! --Service endpoints-->

unless fully qualified, address is relative to base address supplied above -->

endpoint
address =" "
binding =" basichttpbinding "
contract =" contrat. iplayerservice "
behaviorconfiguration =" Web " > endpoint >< br>

<! --Metadata endpoints-->

<! --The metadata exchange endpoint is used by the Service to describe itself to clients.-->

<! --This endpoint does not use a secure binding and shoshould be secured or removed before deployment-->

<Endpoint
Address="MEX"
Binding="Mexico httpbinding"
Contract="Imetadataexchange"/>

</Service>

</Services>

<Behaviors>

<Endpointbehaviors>

<Behavior
Name="Web">

<Webhttp/>

</Behavior>

</Endpointbehaviors>

<Servicebehaviors>

<Behavior
Name="BH">

<! --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>

</Behaviors>

</System. servicemodel>

</Configuration>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.