Skip to content

Instantly share code, notes, and snippets.

@khash
Created November 14, 2011 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khash/1364171 to your computer and use it in GitHub Desktop.
Save khash/1364171 to your computer and use it in GitHub Desktop.
WCF Services Issue
namespace MyApp
{
public class Installer : IWindsorInstaller
{
public static Binding DefaultBinding
{
get
{
return new BasicHttpBinding
{
// other binding config
Security =
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = {ClientCredentialType = HttpClientCredentialType.Windows}
}
};
}
}
private static DefaultServiceModel CreateServiceModel(Type serviceType, Binding binding)
{
return new DefaultServiceModel()
.Hosted()
.AddEndpoints(WcfEndpoint
.ForContract(serviceType)
.BoundTo(binding));
}
public void Install(IWindsorContainer container, IConfigurationStore store)
{
var returnFaults = new ServiceDebugBehavior()
{
IncludeExceptionDetailInFaults = true
};
container.AddFacility<WcfFacility>()
.Register(
Component.For<LogsAndThrows>(),
AllTypes.FromThisAssembly()
.Where(t => t.Name.EndsWith("Service"))
.WithService
.AllInterfaces()
.LifestylePerWcfOperation()
.Configure(c =>
{
c.Interceptors<LogsAndThrows>();
CreateServiceModel(c.Implementation.GetType(), DefaultBinding);
}),
Component.For<IServiceBehavior>().Instance(returnFaults),
Component.For<HoldAccess>().ImplementedBy<HoldAccess>(),
Component.For<IUpdateCache>().ImplementedBy<UpdateCache>(),
Component.For<IHoldDBAccess>().ImplementedBy<HoldDBAccess>());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment