I am confused about the castle wcf facility registration.
I read some blog posts for BasicHttpBinding. But could not find a clear easy sample to setup a net.tcp setup.
I want to host the service from a console application...
I wrote something like this... can you see a problem here?
_container = new WindsorContainer();
_container.AddFacility<WcfFacility>();
_container.Register(Component.For<IMembershipService>().ImplementedBy<MembershipService>()
.AsWcfService(
new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new NetTcpBinding() { PortSharingEnabled = false })
.At("net.tcp://localhost/MembershipService")
)
.PublishMetadata()
)
);
If you wish to publish metadata you will need to enable port sharing (to let the MEX endpoint share the same port as the regular TCP port - you'll get an AddressAlreadyInUse exception if you have this set to false) and you probably need to specify a port on your URL (not sure what port TCP would use otherwise), so your code should be (assuming port 8080 is OK for you):
_container.Register(Component.For<IMembershipService>().ImplementedBy<MembershipService>()
.AsWcfService(
new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new NetTcpBinding() { PortSharingEnabled = true})
.At("net.tcp://localhost:8080/MembershipService")
)
.PublishMetadata()
)
);
This works fine using castle windsor 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With