Write restful with WCF under C #

Source: Internet
Author: User

1. Adding a WCF service library

2. Register the route in global

ROUTETABLE.ROUTES.ADD (New Serviceroute ("API", new Webservicehostfactory (), typeof (API). (OPENAPI.OPENAPI)));

3, add the following configuration in Webconfig

 <system.serviceModel> <servicehostingenvironment aspnetcompatibilityenabled= "true" Multiplesitebindingsenabled= "true"/> <standardEndpoints> <webHttpEndpoint> &LT;STANDARDENDP Oint name= "" helpenabled= "true" automaticformatselectionenabled= "true" crossdomainscriptaccessenabled= "false" Maxreceivedmessagesize= "2147483647" maxbuffersize= "2147483647" maxbufferpoolsize= "4194304"/> </ webhttpendpoint> </standardEndpoints> <bindings> <webHttpBinding> <binding Close timeout= "04:01:00" opentimeout= "04:01:00" receivetimeout= "04:10:00" sendtimeout= "04:01:00" AllowCo Okies= "false" Bypassproxyonlocal= "false" hostnamecomparisonmode= "StrongWildcard" maxbuffersize= "21 47483647 "maxbufferpoolsize=" 2147483647 "maxreceivedmessagesize=" 2147483647 "> <readerquotas ma Xdepth= "maxstringcontentlength=" 2147483647 "maxarraylength=" 2147483647 "       Maxbytesperread= "2147483647" maxnametablecharcount= "2147483647"/> </binding> </webhttpbindi Ng> <!--texting-<basicHttpBinding> <binding name= "Servicesoap"/> </basichttp Binding> <!--texting-</bindings> <!--texting-<client> <endpoint address= "HT Tp://api5.nashikuai.cn/service.asmx "binding=" BasicHttpBinding "bindingconfiguration=" ServiceSoap "contract=" SmsS Ervices.servicesoap "name=" Servicesoap "/> </client> <!--texting-&LT;/SYSTEM.SERVICEMODEL&GT ;

  

Write restful with WCF under C #

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.