0

I have a solution with many WCF web services projects in it (IIS hosted). All of the web services as set up as wsHttpBinding. When referencing each one of the .svc, using a WCF test client, they are all detected correctly as wsHttpBinding - all but one. The web config of that project is identical to the other projects, and there are no service model settings in code. I just can't explain it. To be sure, I tried creating a brand new solution with a single WCF service project in it. The 'WCF Service Application' template project (i.e. Service1 with the built-in GetData(int value) and GetDataUsingDataContract(CompositeType composite) methods. I've changed the bindings to be wsHttpBinding, exposed the mex endpoint but still, can't get the WCF test client (or for that matter, any other project referencing it) to identify its binding as wsHttpBinding, they all detect it as BasicHttpBinding.

Below is (one of the many) attempts I've tried with the config (again, the actual service code is irrelevant here, the binding information is only specified n the web.config)

<system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding
      name                           = "wsHttpBinding_IService1">
      <security mode                 = "Message">
        <transport
          clientCredentialType       = "Windows"
          proxyCredentialType        = "None"
          realm                      = ""/>
        <message
          clientCredentialType       = "Windows"
          negotiateServiceCredential = "true"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<services>
  <service name            = "Service1">
    <endpoint
      address              = ""
      binding              = "wsHttpBinding"
      contract             = "WcfServiceTest.IService1"
      bindingConfiguration = "wsHttpBinding_IService1">
      <identity>
        <dns value         = "localhost"/>
      </identity>
    </endpoint>
    <endpoint
      address              = "mex"
      binding              = "mexHttpBinding"
      contract             = "IMetadataExchange"/>
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

</system.serviceModel>

What else can I do to force it to use wsHttpBinding (other then doing it in code like in this example?

Nir
  • 65
  • 2
  • 8
  • Try removing the mex binding or adding a [server proxy](https://stackoverflow.com/questions/60519743/wcf-error-mismatch-of-the-security-binding-between-the-client-and-the-server). Or [this case](https://stackoverflow.com/questions/4879310/when-setting-up-a-wcf-client-and-server-how-synchronized-does-the-config-files) may be helpful to you. – Jiayao Apr 03 '23 at 09:29
  • @Jiayao: neither removing the mex binding, nor adding bypassProxyOnLocal/useDefaultWebProxy helped. As for the case you referenced, it's not really applicable, I don't have issue with mismatch on client on server. It just seem like wsHttpBinding is not being picked up by the config for some reason – Nir Apr 03 '23 at 14:20

1 Answers1

0

Found the answer - the service name must also match the pattern - namespace.serviceName Without it it seems like it just ignore everything else and sets the binding as BasicHttpBinding

Nir
  • 65
  • 2
  • 8