public void WillRecoverFromAnUnhandledExceptionWithChannelUsingSuppliedModel()
{
using (new WindsorContainer()
.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero)
.Register(Component.For<Operations>()
.DependsOn(new { number = 28 })
.AsWcfService(new DefaultServiceModel()
.AddEndpoints(WcfEndpoint.ForContract<IOperationsEx>()
.BoundTo(new NetTcpBinding { PortSharingEnabled = true })
.At("net.tcp://localhost/Operations2")
)
)))
{
using (var clientContainer = new WindsorContainer()
.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero)
.Register(Component.For<IOperationsEx>()
.Named("operations")
.LifeStyle.Transient
.AsWcfClient()
))
{
var client = clientContainer.Resolve<IOperationsEx>("operations",
new
{
Model = new DefaultClientModel
{
Endpoint = WcfEndpoint.BoundTo(new NetTcpBinding())
.At("net.tcp://localhost/Operations2")
}
});
try
{
client.ThrowException();
}
catch (Exception)
{
client.Backup(new Dictionary<string, object>());
client.Backup(new Dictionary<string, object>());
}
clientContainer.Release(client);
}
}
}