none
通信对象 System.ServiceModel.Channels.ClientPollingDuplexSessionChannel 无法用于通信,因为其处于“出错”状态。 RRS feed

  • 问题

  • wcf项目库的 App.config 配置如下:

      <system.serviceModel>
    
        <client />
    
        <extensions>
          <bindingElementExtensions>
            <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
          </bindingElementExtensions>
          <bindingExtensions>
            <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
          </bindingExtensions>
        </extensions>
    
        <bindings>
          <customBinding>
            <binding name="SilverdrawServiceBinding">
              <binaryMessageEncoding />
              <pollingDuplex inactivityTimeout="02:00:00" serverPollTimeout="00:05:00" 
                maxPendingMessagesPerSession="2147483647" maxPendingSessions="2147483647" />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
    
        <services>
          <service behaviorConfiguration="SilverdrawServiceBehaviour" name="Hqjl.Wcf.Service1">
            <host>
              <baseAddresses>
                <add baseAddress = "http://localhost:8732/Design_Time_Addresses/Hqjl.Wcf/Service1/" />
              </baseAddresses>
            </host>
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="customBinding" bindingConfiguration="SilverdrawServiceBinding" contract="Hqjl.Wcf.IService1"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
    
        <behaviors>
          <serviceBehaviors>
            <behavior name="SilverdrawServiceBehaviour">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <serviceThrottling maxConcurrentSessions="2147483647"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
      </system.serviceModel>

    在 wcf 网站 的项目中, Web.config 的配置 如下:

      <system.serviceModel>
    
        <client />
    
        <extensions>
          <bindingElementExtensions>
            <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
          </bindingElementExtensions>
          <bindingExtensions>
            <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
          </bindingExtensions>
        </extensions>
    
        <bindings>
          <customBinding>
            <binding name="SilverdrawServiceBinding">
              <binaryMessageEncoding />
              <pollingDuplex inactivityTimeout="02:00:00" serverPollTimeout="00:05:00" maxPendingMessagesPerSession="2147483647" maxPendingSessions="2147483647" />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
    
        <services>
          <service behaviorConfiguration="SilverdrawServiceBehaviour" name="Hqjl.Wcf.Service1">
    
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="customBinding" bindingConfiguration="SilverdrawServiceBinding" contract="Hqjl.Wcf.IService1" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
    
        <behaviors>
          <serviceBehaviors>
            <behavior name="SilverdrawServiceBehaviour">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceThrottling maxConcurrentSessions="2147483647" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
      </system.serviceModel>
    
    在 sl 项目中,添加引用System.ServiceModel.PollingDuplex,在访问中 抛出异常,如下:
    通信对象 System.ServiceModel.Channels.ClientPollingDuplexSessionChannel 无法用于通信,因为其处于“出错”状态。
    2010年3月20日 12:16

答案

  • 1.

    指定的方式应该很简单,在客户端配置文件里指定回调地址;

    <endpoint address="http://localhost:8001/Design_Time_Addresses/WcfCallBack/Service1/"
                    binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IService1"
                    contract="ServiceReferenceCallBack.IService1" name="WSDualHttpBinding_IService1">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>

                <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IService1"                          clientBaseAddress="http://localhost:8001">
                                        </binding>
                </wsDualHttpBinding>

    2.客户端要打开防火墙。


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    • 已标记为答案 lfj0912 2010年3月22日 13:42
    2010年3月22日 12:58
    版主

全部回复

  • ClientPollingDuplexSessionChannel

    这个是在哪个模块里?

    2010年3月20日 14:19
  • 多久出的错误?

    我看你的绑定配置“

     <pollingDuplex inactivityTimeout="02:00:00" serverPollTimeout="00:05:00" maxPendingMessagesPerSession="2147483647" maxPendingSessions="2147483647" />
              <httpTransport />
    另外还有一个receivetimeOut的值。

    也要设置一下,和这个inactivityTimeout="02:00:00"设置一样就可以了


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    2010年3月21日 7:08
    版主
  • 是马上出错.

    还有我按照您的方法, 在 wcf 网站 的项目中的 Web.config 和 wcf项目库的 App.config  的配置文件, 添加 receivetimeOut="02:00:00", 出现以下错误:

     远程服务器返回了错误: NotFound。

     

    2010年3月21日 11:13
  • 还有再请教一下端口的问题:

    1. 以下是指定 wcf 库 运行的端口为 8732, 是 vs2010 自动生成的端口, 我没有改

    <add baseAddress = "http://localhost:8732/Design_Time_Addresses/Hqjl.Wcf/Service1/" />

    那么 ,该库的回调端口该怎么指定?

    2.  在 IIS 管理器中, 把 wcf 的网站 指定端口为 8899, 并在防火墙和路由器开放该端口; 

    请问: 是否还需要指定一个回调端口, 并在防火墙和路由器开放?


     

    2010年3月21日 11:23
  • 1.

    指定的方式应该很简单,在客户端配置文件里指定回调地址;

    <endpoint address="http://localhost:8001/Design_Time_Addresses/WcfCallBack/Service1/"
                    binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IService1"
                    contract="ServiceReferenceCallBack.IService1" name="WSDualHttpBinding_IService1">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>

                <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IService1"                          clientBaseAddress="http://localhost:8001">
                                        </binding>
                </wsDualHttpBinding>

    2.客户端要打开防火墙。


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    • 已标记为答案 lfj0912 2010年3月22日 13:42
    2010年3月22日 12:58
    版主