【问题标题】:Getting 404 from WCF webservice over HTTPS通过 HTTPS 从 WCF Web 服务获取 404
【发布时间】:2012-05-27 21:09:57
【问题描述】:

我一直在玩通过 SSL 和负载平衡处理 WCF 的乐趣和游戏:(

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

谁能给点建议?

客户端配置。

<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>

Web 服务网络配置。

 <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>

【问题讨论】:

  • http sniffer, like fiddler 显示了什么?我知道由于 https,您将无法看到内容,但您应该仍然可以看到标题
  • 我得到的错误是“在ourserver.com/API/workflow.svc 没有可以接受消息的端点侦听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在) .
  • 内部异常是“远程服务器返回错误:(404)未找到。”
  • 客户端和服务器之间的合同是否相同?你能生成一个新的服务引用吗?
  • 是的,我可以生成新的服务引用。

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


【解决方案1】:

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

【讨论】:

  • 关闭...负载均衡器正在接受 https 请求并将其发送到 http,然后转到服务器。通过做另一个 stunnel 对其进行排序。
猜你喜欢
  • 2019-11-21
  • 1970-01-01
  • 2020-04-19
  • 1970-01-01
  • 2010-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-20
相关资源
最近更新 更多