我发现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>
当我在serviceBehavior元素中放入serviceCertificate信息时,上面的服务正在运行,但它仍然使用http作为传输通道,尽管消息是由证书加密的。
在这种情况下可以使用https吗? 提前谢谢。
亲切的问候