C# 在Castle WCF设施中托管WebHttp绑定服务
我有一个WCF服务,我想在Castle WCF设施中使用多个绑定托管它,其中一个是WebHttp。我已经完成了与这里描述的相同的配置。 如果我向WebHttpBehavior注册IEndpointBehavior,任何人都可以猜到WebHttp以外的绑定失败。所以我没有注册。这样,只有TCP绑定才能工作。 对于WebHttp绑定,我做错了什么?这是我的密码C# 在Castle WCF设施中托管WebHttp绑定服务,c#,wcf,castle-windsor,C#,Wcf,Castle Windsor,我有一个WCF服务,我想在Castle WCF设施中使用多个绑定托管它,其中一个是WebHttp。我已经完成了与这里描述的相同的配置。 如果我向WebHttpBehavior注册IEndpointBehavior,任何人都可以猜到WebHttp以外的绑定失败。所以我没有注册。这样,只有TCP绑定才能工作。 对于WebHttp绑定,我做错了什么?这是我的密码 string internalEndpointAddress = "http://localhost:8899/DummyService";
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())));
string internalEndpointAddress=”http://localhost:8899/DummyService";
ContractDescription=ContractDescription.GetContract(typeof(IDummyService));
//创建webHTTP绑定
WebHttpBinding WebHttpBinding=新的WebHttpBinding();
EndpointAddress webEndpointAddress=新的EndpointAddress(internalEndpointAddress);
ServiceEndpoint webEndpoint=新的ServiceEndpoint(描述、webhttpbinding、webEndpointAddress);
添加(新的WebHttpBehavior());
//这是wcf注册。为了保持干净,我删除了网络tcp注册。。。
container.AddFacility(f=>f.CloseTimeout=TimeSpan.Zero)
.Register(Component.For())
.由()实施
.生活方式
.AsWcfService(新的DefaultServiceModel()
.Hosted()
.AddEndpoints(WcfEndpoint.FromEndpoint(webEndpoint))
.PublishMetadata(o=>o.EnableHttpGet());
托管或调用WCF服务时,它在哪里失败?我在运行时没有收到异常。但是,当我尝试用一个简单的http GET调用我的方法时,它不会返回响应。您可以浏览承载WCF服务的URL