我们正在使用WCFFacility从托管(IIS7.5)环境中设置服务。我们需要为每个服务提供两个端点,用于.NET客户端的WSHttp和用于其他所有客户端的WebHttp。这个是可能的吗?
我们使用的代码:
_container.Register(
Component
.For<ISomeService>()
.ImplementedBy<SomeService>()
.AsWcfService(new DefaultServiceModel()
.Hosted()
.PublishMetadata(mex => mex.EnableHttpGet())
.AddEndpoints(
WcfEndpoint.BoundTo(new WSHttpBinding()).At("v1/ws"),
WcfEndpoint.BoundTo(new WebHttpBinding()).At("v1/rest")
))
);然后:
RouteTable.Routes.Add(new ServiceRoute("", new DefaultServiceHostFactory(_container.Kernel), typeof(ISomeService)));我假设我们不能真的混合ws/web端点,但这能以其他方式实现吗?我们不想退回到xml配置,但我们需要配置端点。
发布于 2013-02-04 18:03:53
经过一整天的挖掘和尝试,我似乎找到了解决方案。除了最终获得帮助/wsdl页面之外,没有以任何方式进行测试。因此,我暂时不考虑这个问题。
_container.Register(
Component
.For<ISomeService>()
.ImplementedBy<SomeService>()
.AsWcfService(new RestServiceModel().Hosted())
.AsWcfService(new DefaultServiceModel().Hosted()
.PublishMetadata(mex => mex.EnableHttpGet())
.AddEndpoints(
WcfEndpoint.ForContract<ISomeService>().BoundTo(new WSHttpBinding())
)
)
);
RouteTable.Routes.Add(new ServiceRoute("v1/rest", new WindsorServiceHostFactory<RestServiceModel>(_container.Kernel), typeof(ISomeService)));
RouteTable.Routes.Add(new ServiceRoute("v1/ws", new WindsorServiceHostFactory<DefaultServiceModel>(_container.Kernel), typeof(ISomeService)));https://stackoverflow.com/questions/14644342
复制相似问题