I have a WCF service:
<%@ ServiceHost Language="C#" Debug="true" Service="IWW.MIGTurbo2.WCF.Security.SecurityBroker" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>
This works fine using webHttpBinding from my web project.
I also want this service to be usable by a WinForms client, so have added a basicHttpBinding binding.
My server config file is currently:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webScriptEnablingBehavior">
<enableWebScript />
</behavior>
<behavior name="webHttpEnablingBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpEnablingBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior name="webScriptEnablingBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="IWW.MIGTurbo2.WCF.Security.SecurityBroker" behaviorConfiguration="webHttpEnablingBehaviour">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<!-- This works for web-clients -->
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="default"
contract="IWW.MIGTurbo2.WCF.Security.ISecurityBroker"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
<!-- This is for WinForms clients, but isn't working -->
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="default"
contract="IWW.MIGTurbo2.WCF.Security.ISecurityBroker"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
</service>
</services>
<client />
<bindings>
<webHttpBinding>
<binding name="default" ></binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="default" allowCookies="true"></binding>
</basicHttpBinding>
</bindings>
The section marked for WinForms doesn't appear to work. I get an exception:
The endpoint at 'http://localhost:56125/MIGTurbo2_WEB/api/wcf/SecurityBroker.svc' does not have a Binding with the None MessageVersion. 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.
When I try to browse to the .svc file manually using IE. Obviously, the WinForms client doesn't want to know.
Can anyone spread any light on why it isn't working? It almost looks as if I can't have more than one endpoint or the second endpoint isn't configured correctly? Google offers nothing that is particularly useful.