Basic HTTP Binding isn't configured properly

*爱你&永不变心* 提交于 2019-12-09 13:11:23

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!