0

I have a WCF service, which I want to host in Castle WCF facility with multiple bindings and one of them is WebHttp. I have done same configuration as described here Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint. If I register IEndpointBehavior with WebHttpBehavior as anyone can guess bindings other than WebHttp fails. So I'm not registering it. In that way only TCP binding works. For WebHttp binding, what am I doing wrong? Here is my code.

string internalEndpointAddress = "http://localhost:8899/DummyService";

ContractDescription description = ContractDescription.GetContract(typeof(IDummyService));

// Create webHTTP Binding            
WebHttpBinding webhttpbinding = new WebHttpBinding();

EndpointAddress webEndpointAddress = new EndpointAddress(internalEndpointAddress);
    ServiceEndpoint webEndpoint = new ServiceEndpoint(description, webhttpbinding, webEndpointAddress);
    webEndpoint.Behaviors.Add(new WebHttpBehavior());

//And here is the wcf registration. To keep it clean I removed net tcp registration...

container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero)
                     .Register(Component.For<IDummyService>()
                        .ImplementedBy<DummyService>()
                        .LifestyleTransient()
                        .AsWcfService(new DefaultServiceModel()
                                        .Hosted()
                                        .AddEndpoints(WcfEndpoint.FromEndpoint(webEndpoint))
                                        .PublishMetadata(o => o.EnableHttpGet())));
4

0 回答 0