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> <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-</SYSTEM.SERVICEMODEL> ;
Write restful with WCF under C #