When i'm using SessionMode = SessionMode.Required
in servicecontract then i get this error
Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.
anyone tell me a solution?
This error message is seldom clear. Here the answer goes like this, basichttpbinding doesn't support session. So you have to use the below property if you want to use it. [ServiceContract(SessionMode = SessionMode.Allowed)]
This means, If you are trying to configure multiple bindings like basichttp, wshttp, net.tcp, WCF will automatically enable session for other than basichttp binding. so if you put SessionMode.Required instead of Allowed, then you are forced not to use basichttpbinding.
That said, solving this issue usually would require something like this:
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfiguration" />
</protocolMapping>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingConfiguration" transactionFlow="true" />
</wsHttpBinding>
.......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With