0

I have a WCF REST Service with teh following URL: http:/localhost/GetAllOrders

but the factorychannel always genereates the Uri to http:/localhost/Service.svc/GetAllOrders/GetAllOrders

Here is my client factory channel:

Uri address = new Uri("http:/localhost/Service.svc/GetAllOrders");
            var factory = new  System.ServiceModel.Web.WebChannelFactory<App.WebService.IOrderSvc>(address);
            var webHttpBinding = factory.Endpoint.Binding as System.ServiceModel.WebHttpBinding;
            App.WebService.IOrderSvc service = factory.CreateChannel();
            var orders = service.GetAll(); // this one throwing an error since the URI has become http:/localhost/Service.svc/GetAllOrders/GetAllOrders

and here is the service contract:

[WebGet(UriTemplate = "GetAllOrders")]
        [OperationContract]
        List<Order> GetAll();

any idea why the Uritemplate being added twice?

user384080
  • 4,576
  • 15
  • 64
  • 96

1 Answers1

0

The Uri is wrong - it should be service's Uri. You should write:

Uri address = new Uri("http:/localhost/Service.svc/");

agnieszka
  • 14,897
  • 30
  • 95
  • 113