设置传输级安全
问题描述:
我想在webHttp约束力的WCF服务我目前的配置看起来像这样设置传输级安全
<system.serviceModel>
<client>
<endpoint binding="webHttpBinding" bindingConfiguration="webHttp"
contract="PrimeStreamInfoServices.IService1" name="Client" />
</client>
<bindings>
<webHttpBinding>
<binding name="webHttp" maxBufferPoolSize="1500000" maxReceivedMessageSize="1500000" maxBufferSize="1500000">
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="string" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="PrimeStreamInfoServices.Service1" behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttp" contract="PrimeStreamInfoServices.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PrimeStreamInfoServices.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
设置传输层安全性然而,当我跑我的服务我得到例外: 找不到匹配方案HTTPS与结合的WebHttpBinding端点的基址。注册的基地址方案是[http]。
我知道我在想念的东西,我一直在尝试各种事情我无法弄清楚,任何人有什么我必须做一些投入?
答
是 - 切换到HTTPS,用合适的证书。对于HTTP,传输安全由SSL通道提供。你不能有WS *传输安全通过纯HTTPS
答
忽略我以前的答案,我想WsHttpBinding的不是的WebHttpBinding。
这是您用来调用必须以https开头的服务的地址。
+0
在传输过程中,消息是否会对请求进行加密,因此没有数据包嗅探器可以读取纯文本? – Daniel 2009-07-27 20:06:53
答
你可以尝试添加基地址是HTTPS(服务配置的<host>
元素中)?你是否在代码中添加(或多个)基地址?
<service name="PrimeStreamInfoServices.Service1"
behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8080/YourService.svc" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint ......
</service>
不是100%确定,如果这与webHttpBinding一起工作,但试试!
马克
我在哪里可以指定我想HTTPs的? – Daniel 2009-07-27 20:08:16