wcfhttpswshttpbinding

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding with NO SOLUTION YET


I have a WCF Service (with authentication and authorization) hosting in IIS 7.5 using SSL certification in Windows Server 2008 R2. I got error while running the WCF application with Visual Studio in this server. WCF Test Client gave me this error: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. But Its working in IIS. And I can deploy my WCF service in my web application with no error. All suggestions were tried and had no solution.

My 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" />

Any suggestions about it?


Solution

  • Ok, I got it. For those who need help because of the same problem:

    1)I added <serviceCertificate storeLocation="LocalMachine" storeName="My" findValue="bla bla bla" x509FindType="FindByThumbprint" /> under serviceCredentials tag.

    2)I defined 2 bindings. http and https. I removed http binding.

    Thanks anyway...