Issue when hosting multiple services in one WcfFacility

61 views
Skip to first unread message

Tom Dietrich

unread,
Mar 16, 2012, 11:13:15 AM3/16/12
to castle-pro...@googlegroups.com
I'm cross-posting this from stack overflow, since you guys seem to be the go-to, here is the question http://stackoverflow.com/questions/9739668/how-to-host-multiple-services-using-one-wcffacility 

I'm trying to use one WcfFacility to host multiple services under IIS. Everything seems to be working, but as I connect the WCF Test client to each service, the returned WSDL contains a composite of all the services that I've connected to prior to that service as well as that service. If I go back and refresh a service that I connected to earlier, it includes the endpoints for the other services. The configuration is as follows: 

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"))
		)
);

I'd like to add that the services seem to work regardless of where they are called from, so this is more an issue of potential confusion than a critical bug. I'm still learning WCF so maybe there is something really obvious going on here that I've missed.

Thanks in advance for your time!
Reply all
Reply to author
Forward
0 new messages