Search code examples
wcfwshttpbinding

Wshttpbinding translated to basic


I have a WCF service composed by two projects:

  1. WCF service library
  2. WCF Web application

The First project has a service call IMyService implemented by MyService. It is configured by using WS binding and if I press F5 on this project the WCFTestClient render the WS binding. In the web app I have an .svc file with this markup with the same name

 <%@ ServiceHost Language="C#" Debug="true" Service="[Namespace].MyService" %>

If I press F5 on this project it renders a BasicHttpBinding. Same in the Client. Why?


Solution

  • I have just checked that WCF Service Library project by default creates app.config with WSHttpBinding used for default service. When you run WCFTestClient it always uses this local config. If you want to use WCFTestClient to test additional services you must add their configuration to this config. This config is never used for anything else.

    WCF Service application uses web.config. In WCF 4.0 it uses simplified configuration which adds endpoints based on some predefined conditions. By default it adds BasicHttpBinding endpoint to all services exposed over HTTP with common ServiceHostFactory.