Can same WCF be accessed in both Jquery and C#? -


i have created wcf service jquery using this example wcf working in jquery phonegap app can use same wcf service in other application in c#.

one can use same wcf service different applications. create multiple bindings , multiple endpoints same wcf service

multiple bindings

<bindings>   <nettcpbinding>     <binding name="nettcpbindingconfiguration" receivetimeout="infinite" sendtimeout="10.00:00:00" maxbufferpoolsize="1073741824" maxbuffersize="1073741824" maxreceivedmessagesize="1073741824">       <readerquotas maxdepth="32" maxstringcontentlength="2147483647" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384"/>     </binding>   </nettcpbinding>   <webhttpbinding>     <binding name="webhttpbindingconfiguration" receivetimeout="00:10:00"  sendtimeout="10.00:00:00" maxbufferpoolsize="1073741824" maxreceivedmessagesize="1073741824">       <readerquotas maxdepth="32" maxstringcontentlength="2147483647" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384"/>     </binding>   </webhttpbinding> </bindings> 

multiple endpoints -two endpoints exposed,one using webhttpbinding , other using nettcpbinding

please note though difference in endpoints i.e use of behaviorconfiguration="endpointbehavior".the endpoint using webhttpbinding exposes data on json.

<services>   <service behaviorconfiguration="behavior" name="wcfcallbacktry.service1">     <endpoint address="http://localhost:8018/service1.svc" bindingconfiguration="webhttpbindingconfiguration" binding="webhttpbinding"       contract="wcfcallbacktry.iservice" name="httpendpoint" behaviorconfiguration="endpointbehavior"/>     <endpoint address="net.tcp://localhost:8004/service1.svc"  bindingconfiguration="nettcpbindingconfiguration" binding="nettcpbinding"       contract="wcfcallbacktry.iservice" name="nettcpendpoint"/>     <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" />     <host>       <baseaddresses>         <add baseaddress="http://localhost:8018/service1.svc"/>       </baseaddresses>     </host>   </service> </services> 

for exposing wcf using jquery below behavior has used showed in link referenced.

<endpointbehaviors> <behavior name="endpointbehavior">  <webhttp/> </behavior> 

the endpoint using nettcpbinding used client application using c# whereas webhttpbinding used using jquery.

configurations similar above used different or same type of bindings, while exposing different endpoints.

hope helps


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -