Created
November 14, 2011 15:25
-
-
Save khash/1364171 to your computer and use it in GitHub Desktop.
WCF Services Issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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