我有一个带有以下URL的WCF REST服务: http:/localhost/GetAllOrders
但是factorychannel总是将Uri生成到http:/localhost/Service.svc/GetAllOrders/GetAllOrders
这是我的客户端工厂通道:
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下面是服务合同:
[WebGet(UriTemplate = "GetAllOrders")]
[OperationContract]
List<Order> GetAll();你知道为什么Uritemplate被添加了两次吗?
发布于 2012-05-23 20:55:00
Uri错误-它应该是服务的Uri。你应该这样写:
Uri("http:/localhost/Service.svc/"); Uri地址=新的
https://stackoverflow.com/questions/10686693
复制相似问题