I need an svc file to install Castle WcF Facility for non-HTTP services

I am confused about registering a wcf castle object.

I read some blog posts for BasicHttpBinding. But could not find a simple sample to configure the installation of net.tcp.

I want to host a service from a console application ...

I wrote something like this ... can you see the 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() ) ); 
+6
source share
1 answer

If you want to publish metadata, you need to enable port sharing (so that the MEX endpoint has the same port as a regular TCP port, you will get an AddressAlreadyInUse exception if you set it to false), and you probably need to specify the port on your url (don't know which TCP port will use otherwise), so your code should be (assuming port 8080 is right 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 windsor 3.0 in the castle.

+4
source

Source: https://habr.com/ru/post/900734/


All Articles