【问题标题】:Hosting wcf duplex service in IIS在 IIS 中托管 wcf 双工服务
【发布时间】:2012-08-18 01:35:57
【问题描述】:

我可以使用 IIS 托管“正常”的 basichttp 服务并通过本地网络访问它。 问题是,我正在尝试做一个双工服务并将其托管在 IIS 中。

我的网络配置:

<system.serviceModel>
<services>
  <service behaviorConfiguration="BaseBehavior" name="RegistrationService">
    <endpoint binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBind" name="RegistrationService" contract="Service" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="BaseBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsDualHttpBinding>
    <binding name="wsDualHttpBind" sendTimeout="00:01:00">
      <security mode="None">
        <message clientCredentialType="None" />
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

我打开“http://localhost /Service/Service.svc”时收到的错误消息:

“合约要求“双工”绑定“BasicHttpBinding'不支持这个,并且支持配置不正确。”

我用谷歌搜索并找到了 web.config 的不同设置,但没有一个有效。 我的猜测是,web.config 是错误的。

【问题讨论】:

    标签: wcf iis duplex


    【解决方案1】:

    首先,你应该有一个 Service.svc 指向你的服务的实现。 然后,在服务条目中,如果它位于单独的项目中,请尝试在不包含程序集的情况下指定全名(您在 Service.svc 文件的服务属性中使用的名称)。 最后,使用实现的服务契约的全名作为契约属性(这里也省略了汇编)。 端点的名称应该不重要。

    【讨论】:

      【解决方案2】:

      感谢您的快速答复。我的配置完全错误^^

      阅读本文后:

      http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b891610a-6b78-4b54-b9a6-4ec81c82b7c0.aspx

      我从 wsDualHttpBinding 更改为 net.tcp。

      我的新 web.config 如下所示:

      <system.serviceModel>
      
      <behaviors>
        <serviceBehaviors>
          <behavior name="MyBehaviour">
            <serviceMetadata />
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <services>
      <service name="Service" behaviorConfiguration="MyBehaviour">
        <endpoint address=""
                  binding="netTcpBinding"
                  bindingConfiguration="InsecureTcp"
                  contract="IService" />
        <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
      </services>
      <bindings>
        <netTcpBinding>
          <binding name="InsecureTcp" portSharingEnabled="true">
            <security mode="None" />
          </binding>
        </netTcpBinding>
      </bindings>
      

      在 IIS 中,我将 net.tcp 添加到网站。 (http,net.tpc) 并且防火墙必须允许这些端口。

      现在它正在工作。

      【讨论】:

        猜你喜欢
        • 2022-12-13
        • 2020-04-26
        • 1970-01-01
        • 2012-07-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多