First of all sorry for maybe duplicated question but I'm new and at the same time excited about Castle Windsor project. I've refactored my Web API service to use advantages of DI and UnitTesting.
Project structure : API(Web Api) > WcfServiceWrapper (Library Project) >> (IAuthorizationService, IBussinesProcessService, IClientService
... (Service References)). All Service References have their configuration in config file.
In WcfServiceWrapper I was working with ex.:
using(IAuthorizationService serviceClient = new AuthorizationServiceClient()){
}
Now with Castle I want for all Referenced Services (IAuthorizationService, IBussinesProcessService, IClientService ...
) use their implementations (AuthorizationServiceClient, BussinesProcessServiceClient, ClientServiceClient ...
)
Castle configuration is in API project. When I do this :
container.Register(Classes.FromAssemblyNamed("WcfServiceWrapper").Pick().WithServiceAllInterfaces());
at runtime it tells me that ComponentActivator: could not instantiate AuthorizationServiceClient.
I thought it cant read binding Configurations from config file or I don't know.
Can you tell me how can I register this components?
After more detailed search I found that it was common problem with bindings. I had to move all binding configuration from WcfServiceWrappers app.config
to APIs web.config
, so now all service clients can see their binding configuration which is needed in constructor.