我正在尝试使用一个WcfFacility
和 IIS 来托管多个服务,但我看到了一些令人困惑的结果。
这是我的配置:
var baseUri = new Uri(HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped));
container.AddFacility<WcfFacility>(f => { f.CloseTimeout = TimeSpan.Zero; }).Register(
Component.For<IAttributeService>()
.ImplementedBy<AttributeService>()
.AsWcfService(
new DefaultServiceModel()
.Hosted()
.AddEndpoints(
WcfEndpoint.ForContract<IAttributeService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
WcfEndpoint.ForContract<IAttributeService>().BoundTo(new WSHttpBinding()).At("Soap12")
)
.AddBaseAddresses(new Uri(baseUri, "AttributeService.svc"))
),
Component.For<ISessionService>()
.ImplementedBy<SessionService>()
.AsWcfService(
new DefaultServiceModel()
.Hosted()
.AddEndpoints(
WcfEndpoint.ForContract<ISessionService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
WcfEndpoint.ForContract<ISessionService>().BoundTo(new WSHttpBinding()).At("Soap12")
)
.AddBaseAddresses(new Uri(baseUri, "SessionService.svc"))
),
Component.For<ISampleService>()
.ImplementedBy<SampleService>()
.AsWcfService(
new DefaultServiceModel()
.Hosted()
.AddEndpoints(
WcfEndpoint.ForContract<ISampleService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
WcfEndpoint.ForContract<ISampleService>().BoundTo(new WSHttpBinding()).At("Soap12")
)
.AddBaseAddresses(new Uri(baseUri, "SampleService.svc"))
)
);
当我使用 WCF 测试客户端对此进行检查时,似乎每个服务下可用的方法是该服务和我之前混合的所有服务的组合。例子:
我做错了吗?您不能WcfFacility
多次添加,并且在互联网上四处寻找,我似乎找不到有人在一个设施中托管多项服务的示例。
有任何想法吗?