c# - Configuration file error while consuming Wcf service with Ajax Request -
i have facing problem in consuming wcf service using jquery. have got error "configuration binding extension 'system.servicemodel/bindings/webhttpbinding' not found. verify binding extension registered in system.servicemodel/extensions/bindingextensions , spelled correctly."
here web.config file:
<system.web> <compilation debug="true" targetframework="4.0" /> </system.web> <system.servicemodel> <bindings> <webhttpbinding> <binding name="webhttpbindingwithjsonp" crossdomainscriptaccessenabled="true" /> </webhttpbinding> </bindings> <behaviors> <endpointbehaviors> <behavior name="restfulservicebehavior"> <webhttp helpenabled="true"/> </behavior> </endpointbehaviors> <servicebehaviors> <behavior name="webservicebehavior"> <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment --> <servicemetadata httpgetenabled="true"/> <!-- receive exception details in faults debugging purposes, set value below true. set false before deployment avoid disclosing exception info --> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> </behaviors> <services> <service name="wcfservice1.restfulserviceimp" behaviorconfiguration="webservicebehavior"> <endpoint address="" behaviorconfiguration="restfulservicebehavior" bindingconfiguration="webhttpbindingwithjsonp" binding="webhttpbinding" contract="wcfservice1.irestfulserviceimp"/> <!--<endpoint address="mex" binding="mexhttpbinding" contract="wcfservice1.irestfulserviceimp"/>--> <endpoint address="soap" binding="basichttpbinding" contract="wcfservice1.irestfulserviceimp"/> </service> </services> <servicehostingenvironment multiplesitebindingsenabled="true" aspnetcompatibilityenabled="false"/> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true"/> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" /> <add name="access-control-allow-headers" value="content-type" /> </customheaders> </httpprotocol> </system.webserver> <system.diagnostics> <sources> <source name="system.servicemodel" switchvalue="information, activitytracing" propagateactivity="true"> <listeners> <add name="xml" type="system.diagnostics.xmlwritertracelistener" initializedata="c:\log\traces.svclog" /> </listeners> </source> </sources> </system.diagnostics>
this service name restfulserviceimp , contract irestfulserviceimp please need valuable suggestions regarding these.
thanks in advance.
there case mismatch in config,
<bindings> <webhttpbinding> <binding name="webhttpbindingwithjsonp" crossdomainscriptaccessenabled="true" /> </webhttpbinding> </bindings>
and
<endpoint address="" behaviorconfiguration="restfulservicebehavior" bindingconfiguration="webhttpbindingwithjsonp" binding="webhttpbinding" contract="wcfservice1.irestfulserviceimp"/> <!--<endpoint address="mex" binding="mexhttpbinding" contract="wcfservice1.irestfulserviceimp"/>--> <endpoint address="soap" binding="basichttpbinding" contract="wcfservice1.irestfulserviceimp"/>
check case difference in webhttpbinding.. have used webhttpbinding instead of webhttpbinding.
c# ajax wcf jquery
No comments:
Post a Comment