我成功地将 Caste WCF 设施与我的服务集成在一起。现在我尝试配置基于 BasicHttpBinding 的 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上没有可以接受消息的端点侦听。
任何想法缺少什么?先感谢您。