Hi,

Sorry to bother you, but please did you figure out what was wrong with it?

Thanks,
-Mike

On Fri, Jun 15, 2012 at 5:08 PM, Mijo Thomas <[email protected]> wrote:

> Hi,
>
> It's registered in the same place. I'm attaching a very basic sample for
> you which does not work.
>
> I'm trying to host a WCF service(over TCP) inside a Windows Service and
> using Castle Windsor facility. As you could see in the sample, when I
> launch it in debug mode, the service crashes.
>
> Thanks for your help in advance.
>
> Kind Regards,
> - Mike
>
>
> On Fri, Jun 15, 2012 at 3:33 PM, Craig Neuwirt <[email protected]> wrote:
>
>> But  where in your ConfigureContainer.AndRegisterComponents do you
>> register IDependency
>>
>>
>> container.Register(Component.For<IDependency>().ImplementedBy<Dependency>())
>>
>> Is it registered somewhere else?
>>
>> On Jun 15, 2012, at 8:30 AM, Mijo Thomas wrote:
>>
>> Hi,
>>
>> The service is not started. It says stopped and is in errored state. It
>> says "Cannot start because the dependency is not satisfied".
>>
>> Thanks,
>> -Mike
>>
>> On Fri, Jun 15, 2012 at 2:03 PM, Craig Neuwirt <[email protected]>wrote:
>>
>>> I'm probably confused, but what happens when you register
>>> IDependency/Dependency in the container?  Do you get an error?
>>>
>>> -craig
>>>
>>>
>>> On Jun 15, 2012, at 2:16 AM, Mijo Thomas wrote:
>>>
>>>  Hi,
>>>
>>> I'm trying to host my WCF service in a windows service host. For
>>> managing dependencies I'm using Castle WCF facility.
>>>
>>> This is how my ContainerConfiguration(BootStrapper) looks like:
>>>
>>>  public class ConfigureContainer : IConfigureContainer
>>>
>>>
>>>         {
>>>             private const string ServiceOne= "ServiceOne";
>>>
>>>
>>>             private const string ServiceTwo      = "ServiceTwo";
>>>
>>>
>>>             private const string ServiceThree = "ServiceThree";
>>>
>>>
>>>             private const string CurrentAssembly      = "MyAssembly";
>>>
>>>
>>>             private readonly IWindsorContainer container;
>>>
>>>
>>>             public ConfigureContainer(IWindsorContainer container)
>>>
>>>
>>>             {
>>>                 this.container = container;
>>>
>>>
>>>             }
>>>
>>>
>>>             public IWindsorContainer WindsorContainer { get { return 
>>> container; } }
>>>
>>>
>>>
>>>             public void AndRegisterComponents()
>>>
>>>
>>>             {
>>>                 
>>> container.Register(AllTypes.FromAssemblyNamed(CurrentAssembly)
>>>
>>>
>>>                        .Pick().If(type => type.GetInterfaces().Any(i => 
>>> i.IsDefined(typeof(ServiceContractAttribute), true)))
>>>
>>>
>>>                        .Configure(configurer => configurer
>>>
>>>
>>>                                                     
>>> .Named(configurer.Implementation.Name)
>>>
>>>
>>>                                                     .AsWcfService(
>>>
>>>
>>>                                                         new 
>>> DefaultServiceModel()
>>>
>>>
>>>                                                             .AddEndpoints(
>>>
>>>
>>>                                                                 
>>> WcfEndpoint.FromConfiguration(ServiceOne),
>>>
>>>
>>>                                                                 
>>> WcfEndpoint.FromConfiguration(ServiceTwo),
>>>
>>>
>>>                                                                 
>>> WcfEndpoint.FromConfiguration(ServiceThree))
>>>
>>>
>>>                                                                 
>>> .PublishMetadata()))
>>>
>>>
>>>                        .WithService.Select((type, baseTypes) => 
>>> type.GetInterfaces()
>>>
>>>
>>>                            .Where(i => 
>>> i.IsDefined(typeof(ServiceContractAttribute), true))));
>>>
>>>
>>>             }
>>>         }
>>>
>>>
>>> This is how I do my hosting inside the service host:
>>>
>>> partial class DataServicesHost : ServiceBase { private IWindsorContainer
>>> windsorContainer; public DataServicesHost() { InitializeComponent(); }
>>>
>>>         protected override void OnStart(string[] args)
>>>
>>>
>>>         {
>>>             var configure = new ConfigureContainer();
>>>
>>>
>>>             windsorContainer = configure.WindsorContainer;
>>>
>>>
>>>         }
>>>
>>>         protected override void OnStop()
>>>
>>>
>>>         {
>>>            if(windsorContainer != null)
>>>
>>>
>>>            {
>>>              windsorContainer.Dispose();
>>>
>>>
>>>              windsorContainer = null;
>>>
>>>
>>>            }
>>>         }
>>>
>>>
>>>     }
>>>
>>> My ServiceOne is implemented as follows:
>>>
>>> [ServiceContract]
>>>
>>>
>>>     internal interface IServiceOne
>>>
>>>
>>>     {
>>>         [OperationContract]
>>>
>>>
>>>         void DoSomething();
>>>
>>>
>>>     }
>>>
>>>     public class ServiceOne : IServiceOne
>>>
>>>
>>>     {
>>>         private readonly IDependency dependency;
>>>
>>>
>>>         public ServiceOne(IDependency dependency)
>>>
>>>
>>>         {
>>>             this.dependency = dependency;
>>>
>>>
>>>         }
>>>
>>>         public void DoSomething()
>>>
>>>
>>>         {
>>>             dependency.GetSomething();
>>>
>>>
>>>             //do something
>>>         }
>>>
>>>
>>>     }
>>>
>>>     public interface IDependency
>>>
>>>
>>>     {
>>>         void GetSomething();
>>>
>>>
>>>     }
>>>
>>>     public class Dependency : IDependency
>>>
>>>
>>>     {
>>>         public void GetSomething()
>>>
>>>
>>>         {
>>>             //GetSomeThing
>>>
>>>
>>>         }
>>> }
>>>
>>> Now my question is: how do I pass the IDependency to the container? How
>>> will I configure it so that while hosting it, it does't complain about not
>>> letting the host know of the dependency and keeps looking and failing over
>>> the default constructor implementation?
>>>
>>> Thanks, -Mike
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Castle Project Users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/castle-project-users/-/oNA0FXNBI-sJ.
>>> 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.
>>>
>>>
>>>
>>> --
>>> 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.
>>>
>>
>>
>> --
>> 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.
>>
>>
>>  --
>> 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.
>>
>
>

-- 
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