我成功将城堡WCF设施与我的服务相结合。现在我尝试配置基于BasicHttpBinding的HTTPS通信。温莎城堡WCF设施HTTPS
根据下面的博客文章,这不应该是一个大问题:http://blog.adnanmasood.com/2008/07/16/https-with-basichttpbinding-note-to-self/
这里是我的设置。在客户端,我使用以下代码配置Windsor容器:
BasicHttpBinding clientBinding = new BasicHttpBinding();
// These two lines are the only thing I changed here to allow HTTPS
clientBinding.Security.Mode = BasicHttpSecurityMode.Transport;
clientBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
// Everything else worked well with HTTP
clientBinding.MaxReceivedMessageSize = 163840;
clientBinding.MaxBufferSize = (int)clientBinding.MaxReceivedMessageSize;
container = new WindsorContainer();
container.AddFacility<WcfFacility>();
container.Register(
Component.For<IClientService>()
.AsWcfClient(new DefaultClientModel {
Endpoint = WcfEndpoint.BoundTo(clientBinding)
.At(configuration.Get(CFGKEY_SERVICE_CLIENT))
})
);
除此之外,我在客户端没有任何配置。这使用HTTP通信很好。
服务器端得到Web.config中配置如下:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
当我试图通过HTTPS连接://,我得到以下异常:
System.ServiceModel.EndpointNotFoundException:在https://myuri.com/Services/Client.svc处没有可以接受消息的端点。
任何想法缺少什么? 预先感谢您。