I have a very simple service which works fine when not using Castle (which shows that the other codes are correct). I changed my svc file to the following:
<%@ ServiceHost Service="Reporting.WebService.ReportingWebService" Factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration" %>
and register the service using xml as follow:
<component id="Reporting.WebService.ReportingWebService"
service="Reporting.WebService.IReportingWebService, Reporting.WebService"
type="Reporting.WebService.ReportingWebService, Reporting.WebService">
</component>
But I am getting the following error:
[InvalidOperationException: Could not find a component with name Reporting.WebService.ReportingWebService, did you forget to register it?] Castle.Facilities.WcfIntegration.WindsorServiceHostFactory`1.CreateServiceHost(String constructorString, Uri[] baseAddresses)
....
Any idea why it is not registered? ?
----update ----
I have this in windsor configuration:
<facilities>
<facility id='wcf'
type='Castle.Facilities.WcfIntegration.WcfFacility,
Castle.Facilities.WcfIntegration' />
</facilities>
and ReportingWebService is implimented in another assembly.
I cannot see anything wrong with the wire up which leads me to think that either it cannot find your assembly or maybe the type has not been loaded. Because your webservice is referenced in another assembly make sure that it is referenced in the web project. Alternatively switch to doing your wire up in your Global.asax in code which will force you to reference the assembly and load the type:
var container = new WindsorContainer();
container.AddFacility<WcfFacility>()
.Register(Component.For<IReportingWebService>().ImplementedBy<ReportingWebService>());
//Additional wire up
//If you are using Windsor 3.0 and above then the following is not needed
DefaultServiceHostFactory.RegisterContainer(container.Kernel);