json - C# RESTful WCF WebService error -
i created restful/json web service i can consume browser not adding service reference project: fails
endpointnotfoundexception: no endpoint listening on /.../getdevicses, inner exception: remote server not found (404).
one thing think important notice in browser call uri .../devices whereas endpointnotfoundexception seems .../getdevices.
my service exposes 1 method:
[operationcontract] [webget( requestformat = webmessageformat.json, uritemplate = "/devices" )] deviceinforecord[] getdevices();
firewalls disabled , since can consume browser think service configuration ok, i'm not sure client configuration.
here client configuration:
<behaviors> <endpointbehaviors> <behavior name="web"> <webhttp defaultoutgoingresponseformat="json"/> </behavior> </endpointbehaviors> </behaviors> <client> <endpoint address="http://localhost:8733/design_time_addresses/wcfservicelibrary2/service1/" name="service1" binding="webhttpbinding" contract="servicereference1.iservice" behaviorconfiguration="web" /> </client> </system.servicemodel>
here server configuration:
<system.servicemodel> <services> <service name="wcfservicelibrary2.service1"> <endpoint address="" binding="webhttpbinding" contract="wcfservicelibrary2.iservice" behaviorconfiguration="restfulbehavior"> <identity> <dns value="localhost" /> </identity> </endpoint> <host> <baseaddresses> <add baseaddress="http://localhost:8733/design_time_addresses/wcfservicelibrary2/service1/" /> </baseaddresses> </host> </service> </services> <behaviors> <endpointbehaviors> <behavior name="restfulbehavior"> <webhttp defaultoutgoingresponseformat="json" /> </behavior> </endpointbehaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true" httpsgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel>
i tried several suggested solutions no luck hope expert can help. thanks.
i not sure requirement. if want have proxy created service, rest service not provide want.
you must have add endpoint "basichttpbinding" created proxy , use in code.
you can try adding end point , try adding service serference
<endpoint address="" binding="basichttpbinding" contract="wcfservicelibrary2.iservice">
in way service can exposed 2 different endpoints. (rest , soap).
Comments
Post a Comment