我发现 WCF WsDualHttpBinding 接受 http,但是 https 是不可接受的。如果使用 https,我会收到以下错误:
System.ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: context.ListenUriBaseAddress
at System.ServiceModel.Channels.TransportChannelListener..ctor(TransportBindingElement bindingElement, BindingContext context, MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode)
at System.ServiceModel.Channels.HttpChannelListener..ctor(HttpTransportBindingElement bindingElement, BindingContext context)
at System.ServiceModel.Channels.HttpChannelListener`1..ctor(HttpTransportBindingElement bindingElement, BindingContext context)
我的环境是Win7 pro、.net 4.0、VS2013 pro。
这里附上我的设置:
<wsDualHttpBinding>
<binding name="customWsDualHttpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsDualHttpBinding>
<service name="Reporting.DuplexService" behaviorConfiguration="customBehavior">
<endpoint address="http://localhost:8123/Reporting/Duplex"
binding="wsDualHttpBinding" bindingConfiguration="customWsDualHttpBinding"
contract="WcfServices.Interfaces.IDuplexReportingService"/>
</service>
当我将 serviceCertificate 信息放在 customBehavior 元素中时,上述服务正在运行,但是它仍然使用 http 作为传输通道,尽管消息是由证书加密的。
在这种情况下可以使用 https 吗?提前致谢。
亲切的问候