Hello,

Basically, you need zero configuration in app.config file.

You can do all WCF-specific configuration with fluent registration API
presented by WCF facility library extension methods to Castle Windsor
container. For samples you can check the unit tests of the project - which
are now integrated with Castle.Windsor repo - instead of outdated blog
posts spreaded all over...


WillApplyServiceAwareExtensions  test could be sample for you
https://github.com/castleproject/Windsor/blob/master/src/Castle.Facilities.WcfIntegration.Tests/Service/WcfServiceFixture.cs



Also [SetUp] part could ring some bells:
https://github.com/castleproject/Windsor/blob/master/src/Castle.Facilities.WcfIntegration.Tests/Service/Lifestyle/PerWcfOperationLifestyleTestCase.cs




2012/5/29 Mijo Thomas <[email protected]>

> I’m trying to use Castle WCF integration facility in my WCF project,
> but got lost in the way. Can you please help me out?
>
> So, here is the situation:
>
> I have a WCF Service Library, which is hosted inside a Windows Service
> over TCP. Following is what is in my WCF Service Library: Service
> Impl:
>
> [ServiceContract]
>    public interface ICalculatorService
>    {
>        [OperationContract]
>        int Add(int x, int y);
>    }
>
>    public class CalculatorService : ICalculatorService
>    {
>        public int Add(int x, int y)
>        {
>            return x + y;
>        }
>    }
> Configuration:
>
>  <system.serviceModel>
>    <services>
>      <service name="namespace.CalculatorService">
>        <endpoint address="" binding="netTcpBinding"
> bindingConfiguration=""
>          contract="namespace.iCalculatorService">
>          <identity>
>            <dns value="localhost" />
>          </identity>
>        </endpoint>
>        <endpoint address="mex" binding="mexTcpBinding"
> bindingConfiguration=""
>          contract="IMetadataExchange" />
>        <host>
>          <baseAddresses>
>            <add baseAddress="http://localhost:8732/
> CalculatorService/" />
>          </baseAddresses>
>        </host>
>      </service>
>    </services>
>    <behaviors>
>      <serviceBehaviors>
>        <behavior name="">
>          <serviceMetadata httpGetEnabled="false" />
>          <serviceDebug includeExceptionDetailInFaults="false" />
>        </behavior>
>      </serviceBehaviors>
>    </behaviors>
>  </system.serviceModel>
>
> Container Configuration This is inside WCF project were I register
> everything to castle (I'm not sure where the wcf facility should be
> registered, whether it should be registered from the WCF service or
> from the Windows service which hosts the WCF service).
>
>  public class ConfigureContainerCastle
>    {
>        private readonly IWindsorContainer container;
>
>        public ConfigureContainerCastle(IWindsorContainer container)
>        {
>            this.container = container;
>        }
>
>        public void Configure()
>        {
>            // Any component registration.
>
>
> container.Register(Component.For<ICalculatorService>().ImplementedBy<CalculatorService>());
>            //All other component registration.
>        }
>    }
> Following is what is in my Windows Service:
>
>  public class Host<T>:ServiceBase
>    {
>     private ServiceHost serviceHost = null;
>            protected override void OnStart(string[] args)
>            {
>                if (serviceHost != null)
>                {
>                    serviceHost.Close();
>                }
>
>                // How do I call the DefaultServiceHostFactory and
> start the service?
>                // Should I call the WCF facility from here or from
> WCF service library?
> //                var container = new WindsorContainer();
>  //              var configureContainer = new
> DataServicesConfigureContainer(container);
>    //            var hostFactory = new
> DefaultServiceHostFactory(container.Kernel);
>
>                serviceHost = new ServiceHost(typeof (T));
>                serviceHost.Open();
>            }
>
>            protected override void OnStop()
>            {
>                if (serviceHost == null)
>                    return;
>
>                serviceHost.Close();
>                serviceHost = null;
>            }
>    }
> And my configuration(app.config) for Windows Service is same as my WCF
> service, literally line by line.
>
> Now the question is, how do I wire this all together with WCF
> facility? I have seen lot of examples using http and global.asax, but
> none for windows services. Can you please help? Even an appropriate
> link to it will be helpful.
>
> Thanks, -Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>


-- 
Berke SOKHAN.

http://twitter.com/berkesokhan
http://blog.berkesokhan.com
http://www.birliktegelistir.com/editors.aspx

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to