複数のバインディングを備えたCastle WCF施設でホストしたいWCFサービスがあり、そのうちの1つはWebHttpです。ここで説明されているのと同じ構成を行いましたエンドポイントごとにキャッスルWCF統合機能エンドポイントの動作を指定します。IEndpointBehavior を WebHttpBehavior に登録すると、WebHttp 以外のバインディングは誰でも推測できるため、失敗します。なので登録はしません。この方法では、TCP バインディングのみが機能します。WebHttp バインディングの場合、何が間違っていますか? これが私のコードです。
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())));