C# RouteTable Routes,做我自己的代理?
我喜欢控制并知道发生了什么,我也不喜欢在我的Web服务中有任何扩展(.svc)。因此,我没有在C# RouteTable Routes,做我自己的代理?,c#,wcf,C#,Wcf,我喜欢控制并知道发生了什么,我也不喜欢在我的Web服务中有任何扩展(.svc)。因此,我没有在Web.config中定义任何端点。我使用RouteTable类添加Routes。例如: RouteTable.Routes.Add( new ServiceRoute(@"Default", new CustomWebServiceHostFactory(), typeof(DefaultServi
Web.config
中定义任何端点。我使用RouteTable
类添加Routes
。例如:
RouteTable.Routes.Add(
new ServiceRoute(@"Default",
new CustomWebServiceHostFactory(),
typeof(DefaultService)));
RouteTable.Routes.Add(
new ServiceRoute(@"Customer",
new CustomWebServiceHostFactory(),
typeof(CustomerService)));
我尝试像这样在客户端消费
_defaultService = new ChannelFactory<IDefaultContract>(
new BasicHttpBinding(), new EndpointAddress(@"http://myWeb.com/Default/")).CreateChannel();
\u defaultService=newchannelfactory(
新建BasicHttpBinding(),新建EndpointAddress(@)http://myWeb.com/Default/))创建通道();
我得到错误:“没有端点侦听…”使用浏览器,我可以调用任何操作(myWeb.com/Default/ReturnBool returns true)在
CustomWebServiceHostFactory
中添加了BasichtpBinding
ServiceEndpoint,现在如果合同可用,我可以作为客户端使用服务