基本 HTTP 绑定配置不正确

发布于 2024-10-16 12:27:19 字数 1384 浏览 4 评论 0原文

我已经使用 wsHTTPBinding 配置了 WCF 服务,但即使这样我也收到错误

合同需要会话,但绑定“BasicHttpBinding”不支持它或未正确配置以支持它。

这是服务合同定义

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

这是服务实现定义

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

这是配置设置

<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>

非常感谢有关此问题的任何建议。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人生戏 2024-10-23 12:27:19

如果您使用的是 wcf 4.0,则打开 web.config/app.config 并在 标记内添加以下标记。

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

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文