Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem creating WCF service with Windsor

Does anyone know how to configure WCF using Windsor on IIS 7.0? I'm using the latest from WCF Windsor facility trunk and Windsor 2.1.1. The example on http://www.castleproject.org/container/facilities/trunk/wcf/index.html is out of date. Even demo project in WCF facility doesn't mention how to setup WCF service in IIS using the config and I couldn't find any example where I can setup WCF on server side using system.serviceModel section of web.config or even through code. When I use the following code it always creates basicHttpBinding and I couldn't figure out how to setup different bindings.

protected void Application_Start(object sender, EventArgs e)
{
    var returnFaults = new ServiceDebugBehavior
                           {
                               IncludeExceptionDetailInFaults = true,
                               HttpHelpPageEnabled = true
                           };

    var metadata = new ServiceMetadataBehavior {HttpGetEnabled = true};

    container = new WindsorContainer()
        .AddFacility<WcfFacility>()
        .Register(
            Component.For<IServiceBehavior>().Instance(returnFaults),
            Component.For<IServiceBehavior>().Instance(metadata),
            Component.For<IMyService>()
                     .Named("MyService")
                     .ImplementedBy<MyService>()
                     .LifeStyle.Transient
            );
}

And here is MyService.svc

<%@ ServiceHost Language="C#" Debug="true" Service="MyService" 
                Factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration" %>
like image 987
Ali B Avatar asked Jun 07 '26 06:06

Ali B


1 Answers

I recently wrote a blog post about Windsor's WCF Facility. Be sure to read the comments as well, as they include a discussion involving one of Windsor's active committers; they should give you a pretty good impression of the future direction.

like image 68
Mark Seemann Avatar answered Jun 10 '26 18:06

Mark Seemann