找不到与端点的方案http匹配的基址,并使用NO SOLUTION YET绑定WSHttpBinding

时间:2015-02-06 15:15:27

标签: wcf https wshttpbinding

我在IIS 7.5中使用Windows Server 2008 R2中的SSL认证托管WCF服务(具有身份验证和授权)。我在此服务器中使用Visual Studio运行WCF应用程序时出错。 WCF测试客户端给了我这个错误:无法找到与绑定WSHttpBinding的端点的方案https匹配的基址。但它在IIS中工作。我可以在我的Web应用程序中部署我的WCF服务,没有错误。所有建议都经过了尝试,没有解决方案。

我的web.config:

<system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpEndpointBinding">
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="None"/>
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<services>
  <service behaviorConfiguration="ServiceBehavior" name="TBBWS.TBBService">

    <endpoint address=""  binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
     name="wsHttpEndpoint" contract="TBBWS.ITBBService" />

    <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration=""
      name="MexHttpsBindingEndpoint" contract="IMetadataExchange"/>

  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom"
          customUserNamePasswordValidatorType="TBBWS.CustomValidation, App_Code" />
      </serviceCredentials>
      <serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="TBBWS.CustomAuthorizationPolicy, App_Code" />
        </authorizationPolicies>
      </serviceAuthorization>
    </behavior>
  </serviceBehaviors>
</behaviors>

<protocolMapping>
  <remove scheme="http" />
  <add binding="wsHttpBinding" scheme="https" />
</protocolMapping>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

有关它的任何建议吗?

1 个答案:

答案 0 :(得分:0)

好的,我明白了。对于因同样问题需要帮助的人:

1)我在serviceCredentials标记下添加了<serviceCertificate storeLocation="LocalMachine" storeName="My" findValue="bla bla bla" x509FindType="FindByThumbprint" />

2)我定义了2个绑定。 http和https。我删除了http绑定。

非常感谢...