Basic HTTP Binding isn't configured properly

Vikram picture Vikram · Feb 8, 2011 · Viewed 14.6k times · Source

i have configured a WCF service with wsHTTPBinding but even then i get the error

Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.

here is the service contract definition

<ServiceContract(SessionMode:=SessionMode.Required)>
Public Interface IPrivateService

Here is the service implementation definition

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
Public Class PrivateService
    Implements IPrivateService

Here is the config settings

<services>
    <service behaviorConfiguration="behaviorAction" name="Viking.Service.PrivateService">
            <endpoint address="RequiredService" binding="wsHttpBinding" bindingConfiguration="bindingAction" contract="Viking.Service.IPrivateService">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
</services>
<bindings>
          <wsHttpBinding>
            <binding name="bindingAction" transactionFlow="false" sendTimeout="00:30:00" receiveTimeout="00:30:00">
              <reliableSession enabled="true"/>
            </binding>
          </wsHttpBinding>
</bindings>

truly appreciate any advise on the issue.

Answer

santosh singh picture santosh singh · Feb 8, 2011

If you are using wcf 4.0 then open web.config/app.config and add following tag inside <system.serviceModel> tag.

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