Https和找不到与绑定WSHttpBinding的端点的方案https匹配的基址

时间:2015-01-27 14:48:51

标签: c# wcf https

我在Windows Server 2012中的网站IIS中托管了WCF服务。

网站绑定只有

  

https myhostname.labsoa 443

我在IExplorer https://myhostname.labsoa/RoutingService.svc

中调用了网址

我只想使用 https

致电Wcf服务

注意:用 myhostname.labsoa

替换实际值

我收到邮件错误:

  

无法找到与方案http匹配的基地址   绑定WSHttpBinding的端点。注册的基地址方案   是[https]

在我的WCF服务主机中,我有以下配置文件:

的web.config

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
    <customErrors mode="Off"></customErrors>
  </system.web>
  <system.serviceModel>
    <bindings configSource="Config\system.serviceModel.bindings.config"/>
    <services configSource="Config\system.serviceModel.services.config"/>
    <behaviors configSource="Config\system.serviceModel.behaviors.config"/>
    <client configSource="Config\system.serviceModel.client.config"/>
    <routing configSource="Config\system.serviceModel.routing.config"/>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment 
     aspNetCompatibilityEnabled="false"
     multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

配置\ system.serviceModel.behaviors.config

<behaviors>
  <serviceBehaviors>
    <behavior name="routingData">
      <serviceMetadata httpGetEnabled="True"
                       httpsGetEnabled="true" />
      <routing filterTableName="routingTable1" routeOnHeadersOnly="false" />
     <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

配置\ system.serviceModel.bindings.config

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_Default" closeTimeout="00:05:00"
             openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
             allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
             messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             useDefaultWebProxy="true">

      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
  <wsHttpBinding>
    <binding name="wsHttpBinding_Default" maxReceivedMessageSize="2147483647">

     <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
      </security>
       </binding>

  </wsHttpBinding>
</bindings>

配置\ system.serviceModel.services.config

<services>
  <service behaviorConfiguration="routingData" 
      name="System.ServiceModel.Routing.RoutingService">
    <host>
      <baseAddresses>
        <add  baseAddress="https://myhostname.labsoa/RoutingService.svc"/>
      </baseAddresses>
    </host>
    <endpoint address=""
              binding="wsHttpBinding"
              name="reqReplyEndpoint"
              contract="System.ServiceModel.Routing.IRequestReplyRouter" />
    <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange"  />
    <endpoint
              address="/Contacto"
              binding="wsHttpBinding"
              contract="System.ServiceModel.Routing.IRequestReplyRouter"
              name="ContactoRouting"
              bindingConfiguration="wsHttpBinding_Default"
              />

有关它的任何建议吗?

1 个答案:

答案 0 :(得分:0)

您的端点配置没有bindingConfiguration。 以下配置

<endpoint address=""
          binding="wsHttpBinding"
          name="reqReplyEndpoint"
          contract="System.ServiceModel.Routing.IRequestReplyRouter" />

应该是

<endpoint address=""
          binding="wsHttpBinding"
          name="reqReplyEndpoint"
          bindingConfiguration="wsHttpBinding_Default"
          contract="System.ServiceModel.Routing.IRequestReplyRouter" />