I created a restful/json web service that i can consume with my browser but not adding a service reference from a project: it fails with
EndpointNotFoundException: no endpoint listening on /.../GetDevicses, Inner exception: remote server not found (404).
One thing i think is important to notice is that in my browser i call uri .../Devices whereas EndpointNotFoundException seems to look for .../GetDevices.
My service exposes only one method:
[OperationContract]
[WebGet( RequestFormat = WebMessageFormat.Json, UriTemplate = "/Devices" )]
DeviceInfoRecord[] GetDevices();
Firewalls are disabled and since i can consume from browser i think service configuration is ok, but i'm not sure about client configuration.
Here is 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 is 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 with no luck so i hope some expert can help. Thanks.
HttpClientor other similar HTTP oriented technologies to communicate with a REST service. SOAP services, on the other hand, do use proxies.