问题
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.
回答1:
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>
来源:https://stackoverflow.com/questions/4930403/basic-http-binding-isnt-configured-properly