Re: Why does a IIS hosted WCF service implemented with Castle Windsor require a base address?

272 views
Skip to first unread message

Craig Neuwirt

unread,
Aug 8, 2012, 1:57:54 PM8/8/12
to castle-pro...@googlegroups.com
If it's being hosted in IIS you probably need to mark it as hosted so it should look something like

container.AddFacility<WcfFacility>()
.Register(Component.For<IMyService>().ImplementedBy<MyService>().AsWcfService(new DefaultServiceModel().Hosted()).IsDefault()

On Aug 8, 2012, at 9:26 AM, Anton wrote:

> This is cross post from a SO question (http://stackoverflow.com/questions/11864882/why-does-a-iis-hosted-wcf-service-implemented-with-castle-windsor-require-a-base), but I figured you might prefer answering them here.
>
> I have a .NET 4.0 WCF service that's implemented with Castle Windsor (v3.1). The service is hosted in IIS 7 and I use the Visual Studio Development Server when running locally. My dev server assigns a specific port to the service.
>
> Now, if I don't add a base address in my web.config I will get an exception from Castle Windsor saying:
>
> Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [].
>
> But, if I do assign a localhost address with the same port as my developer server, I get a port conflict.
>
> Why do I need a base address in this case, and how do I handle the port conflict? I want it to be that specific port.
>
> Here's my Castle Windsor-related code. The container is created in my Application_Start() in the Global.asax.cs file.
>
> public class ServiceInstaller : IWindsorInstaller
> {
> public void Install(IWindsorContainer container, IConfigurationStore store)
> {
> container.AddFacility<WcfFacility>()
> .Register(Component.For<IMyService>().ImplementedBy<MyService>().AsWcfService<IMyService>().IsDefault()
> );
> }
> }
> Also, I'm not interested in hosting several services, there's just one.
> Is there more configuration to be added after the AsWcfService() call?
>
> Thanks!
>
> --
> 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/-/SbqtxgkRuPUJ.
> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
>

Anton

unread,
Aug 9, 2012, 2:22:13 AM8/9/12
to castle-pro...@googlegroups.com
Thank you very much, it was as simple as that.
> To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages