我想通過單個WCF實現多個服務合同。Castle Windsor單一服務上多個接口的組件註冊
我試圖運行此代碼:
return new WindsorContainer()
.AddFacility<WcfFacility>()
.Register(
Component.For<IServiceBehavior>().Instance(metadata),
Component.For<IServiceBehavior>().Instance(debug),
Component
.For<IBlogService>()
.ImplementedBy<DefaultBlogService>()
.Named("blogService")
.LifeStyle.Transient
.ActAs(new DefaultServiceModel().Hosted()
.AddEndpoints(
WcfEndpoint.BoundTo(new BasicHttpBinding()))),
Component
.For<IBlogServiceAlternate>()
.ImplementedBy<AlternateBlogService>()
.Named("blogService")
.LifeStyle.Transient
.ActAs(new DefaultServiceModel().Hosted()
.AddEndpoints(
WcfEndpoint.BoundTo(new BasicHttpBinding()))),
Component
.For<ILogger>()
.ImplementedBy<DefaultLogger>()
.LifeStyle.Transient
);
,但它告訴我,「blogservice」已被註冊。 我加載了2個通過不同類實現的不同接口。 我陷入了這一點。
我知道,我這樣做是故意的,這個想法是兩個接口註冊到同一服務。 就像我們可以做的一樣,以防我們有2個ServiceContacts。我們想連接到相同的服務的 。 – barroei 2010-08-28 20:12:33