代码之家  ›  专栏  ›  技术社区  ›  REA_ANDREW

提供给ServiceHost的基址不是HTTPS

  •  0
  • REA_ANDREW  · 技术社区  · 16 年前

    我正在尝试将wcf服务配置为https。我已经用相关地址配置了行为和服务,但是我不明白为什么提供给服务主机的地址仍然是HTTP。

    我使用的行为如下:

        <behavior name="RequestProcessorBehavior">
          <serviceCredentials>
            <userNameAuthentication 
              userNamePasswordValidationMode="Custom" 
              customUserNamePasswordValidatorType="ServiceAuthentication,Services"/>
          </serviceCredentials>
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances="500"/>
        </behavior>
    

    服务元素在这里

    <service name="MyNamespace.WcfRequestProcessor" behaviorConfiguration="RequestProcessorBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="https://xxxxxxxxxxxxxx/Services/"/>
              </baseAddresses>
            </host>
            <!-- 
              Use the listenUri attribute if this causes a problem with the load balancer.
              The url of the listenUri should be that of the load balancer
            -->
            <endpoint address=""
                      bindingNamespace="https://xxxxxxxxxxxxxx/Services/"
                      contract="MyNamespace.IWcfRequestProcessor"
                      binding="basicHttpBinding"
                      bindingConfiguration="RequestProcessorBinding">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="wsHttpBinding"
                      bindingNamespace="https://xxxxxxxxxxxxxx/Services/"
                      contract="MyNamespace.IWcfRequestProcessor"
                      binding="wsHttpBinding"
                      bindingConfiguration="wsBinding">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>
    

    当我在servicehost的构造函数中添加断点时,我可以看到baseaddresses参数只包含一个地址,即http而不是https。当我尝试访问svc页面时,我会得到以下错误,我可以理解为什么它会显示这一点,但我看不到我可以更改什么来使baseaddress传递给servicehost构造函数https而不是http。

    找不到基地址 匹配终结点的方案https 具有绑定basichttpbinding。 注册基址计划是 [ http]。

    任何帮助都将不胜感激。


    更新第1号

    我在最初的问题中没有提到的绑定配置部分:

    <bindings>
      <basicHttpBinding>
        <binding name="RequestProcessorBinding" maxReceivedMessageSize="2147483647" receiveTimeout="00:30:00" sendTimeout="00:30:00">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    

    目前,这是在开发环境和IIS6中进行的。这在默认网站中。

    1 回复  |  直到 16 年前
        1
  •  1
  •   tomasr    16 年前

    您运行的是IIS还是自托管?如果是IIS,则需要为SSL正确配置IIS。另外,您没有提到您的绑定配置是什么样子的,但是需要设置它来启用传输安全性。

    推荐文章