I'm successfully using Castle Windsor WCF Integration Facility in my WCF client application to get a connection to the server and make service requests:
_container = new WindsorContainer();
_container.Kernel.AddFacility<WcfFacility>();
_container.Register(Component
.For<IService>()
.AsWcfClient(new DefaultClientModel(WcfEndpoint.FromConfiguration("Service"))));
// ...
var service = _container.Resolve<IService>();
service.SomeOperation();
However, I'd like to display to the user the endpoint address they're connected to. With svcutil-generated proxy objects, one can get the address using:
var address = client.Endpoint.Address.ToString();
I know I can examine the application config and fetch the endpoint details that way, but is it possible to get it directly from the Castle Windsor proxy object, or from the configuration process?
Well, if you really have to, there's a way, but it's not pretty:
var service = container.Resolve<IService>();
var meta = (IWcfChannelHolder) service;
var channel = (IClientChannel) meta.Channel;
var address = channel.RemoteAddress;