我想设置一个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开头的服务的地址。

HTTPS://机器/服务名称

你能尝试添加基地址是HTTPS(服务配置的<host>元素中)?要补充的代码(或多个)基址(ES)?

<service name="PrimeStreamInfoServices.Service1" 
         behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
   <host>
      <baseAddresses>
         <add baseAddress="https://localhost:8080/YourService.svc" />
      </baseAddresses>
   </host>
   <!-- Service Endpoints -->
   <endpoint ......
</service>

不是100%肯定,如果是用的WebHttpBinding工作,但试试看!

马克

记住,除了正确的WCF的配置,你还需要配置IIS属性上启用SSL(包括设置SSL正确X.509证书)。该文档对如何做到这一点一些像样的信息。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top