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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -