【问题标题】:WCF configuration with https使用 https 的 WCF 配置
【发布时间】:2012-02-09 19:46:34
【问题描述】:

我在现有 WCF 服务上的开发环境中设置 HTTPS 没有任何成功。使用http服务很好。我正在使用hosts文件重定向到localhost,它一直在为http工作。

我的网络服务配置

<services>
  <service name="EnfieldWebService">
    <endpoint address="https://enfieldwebservice.devserver.int/EnfieldWebService.svc"
    binding="basicHttpBinding" bindingConfiguration="transportSecurity" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="transportSecurity">
      <security mode="Transport">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

客户端配置

<bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IEnfieldWebService" 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="Transport">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://enfieldwebservice.devserver.int/EnfieldWebService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEnfieldWebService"
            contract="HttpsEnfieldService.IEnfieldWebService" name="BasicHttpBinding_IEnfieldWebService" />
    </client>

以及单元测试结果:

System.ServiceModel.EndpointNotFoundException:没有端点监听 https://enfieldwebservice.devserver.int/EnfieldWebService.svc那个 可以接受消息。这通常是由不正确的地址引起的 或 SOAP 操作。有关更多详细信息,请参阅 InnerException(如果存在)。 ---> System.Net.WebException:远程服务器返回错误:(404) 未找到。

【问题讨论】:

    标签: wcf configuration https


    【解决方案1】:

    使用 WCF 配置编辑器重写基本相同的配置。它删除的只是

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    

    原来这个功能只兼容http,并且破坏了https。

    【讨论】:

    • 如果您列出了多个服务怎么办?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-14
    • 1970-01-01
    • 2014-09-23
    • 2011-03-05
    相关资源
    最近更新 更多