通过HTTPS从WCF Web服务获取404

时间:2012-05-21 11:04:45

标签: wcf web-services https http-status-code-404 wcf-binding

我一直很乐意和游戏处理WCF over SSL和负载平衡:(

目前的观点是,我们似乎到达了服务器,但它不喜欢配置中的终点。

任何人都可以提出建议吗?

客户端配置。

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IWorkflowAPI" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="TransportWithMessageCredential">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://ourserver.com/API/workflow.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IWorkflowAPI" contract="Warms.IWorkflowAPI"
                name="BasicHttpBinding_IWorkflowAPI" />
        </client>
    </system.serviceModel>

Webservice web config。

 <system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
      <behavior name="Originator Secured">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        <serviceCredentials>
          <userNameAuthentication userNamePasswordValidationMode="Custom" />
        </serviceCredentials>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <services>
    <service name="xx.xx.Web.UI.API.Workflow" behaviorConfiguration="Originator Secured">
      <endpoint address="https://ourserver/API/workflow.svc" binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IWorkflowAPI" contract="xx.xx.Web.UI.API.IWorkflowAPI"
      name="BasicHttpBinding_IWorkflowAPI"  listenUri="/" />
    </service>
  </services>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  <bindings>
    <basicHttpBinding>
           <binding name="BasicHttpBinding_IWorkflowAPI" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="TransportWithMessageCredential">
          <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
    <wsHttpBinding>
      <binding name="Workflow API Binding">
        <security mode="TransportWithMessageCredential">
          <transport clientCredentialType="None" />
          <message clientCredentialType="UserName" />
        </security>
      </binding>
    </wsHttpBinding>
    <customBinding>
      <binding name="CustomHttpBinding">
        <security allowInsecureTransport="True">
        </security>
        <httpTransport />
      </binding>
    </customBinding>
  </bindings>
</system.serviceModel>

1 个答案:

答案 0 :(得分:2)

也许您的负载均衡器没有使用SSL来连接到真正的Web服务器。启用传输安全性后,您的WCF服务将不会在端口80上响应,仅在443上响应。 我认为你的选择是: 1.让负载均衡器在自身和Web服务器之间重新协商SSL 2.在WCF配置中关闭传输安全性并仅使用消息安全性,为负载均衡器留下SSL。