我采用的wsDualHttpBinding绑定来实现回调的,但是在本机测试可以的程序,把服务端部署到服务器后,客户端就不能访问回调服务了.会出现超时现象.
不知各位有没有遇到这种情况.我试着从服务端ping客户端,ping不通,可能就是因为这个不能实现双通道吧?但是用tcp协议是可以,这容易理解,但这不是我要的结果.我希望可以用iis作为服务端,实现双通道,希望各位给点策略!

解决方案 »

  1.   

    wsDualHttpBinding应该是基于http的.http协议能通吗?是不是有防火墙啊什么的
      

  2.   

    我觉得首先是服务器那边可能不允许访问客户端,另外客户端也可能由于各原因比如防火墙什么的。以上的这些问题可以通过配置文件,或者在代码里解决吗?
    如果不行的话,只能改用TCp协议了。
      

  3.   

    http不行,tcp肯定不行,http是可以穿过防火墙的,但tcp就有可能不行,你的客户端和服务器是在同一个网络吗?还是在外网?
    你贴你的配置吧,极有可能是权限问题,以前我碰到过的,还有就是客户端是vista的话可能也会有这个问题。
      

  4.   

    客户端跟服务端都同一个网络中的。
    服务端配置文件:
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="LoaderServiceBehavior">
              <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:9001/" />
            </behavior>
            <behavior name="NewBehavior">
              <serviceMetadata httpGetEnabled="false"/>
              <serviceTimeouts transactionTimeout="00:03:00" />
              <dataContractSerializer maxItemsInObjectGraph="65536000" />
            </behavior>
          </serviceBehaviors>    </behaviors>
        <bindings>
          <wsDualHttpBinding>
            <binding name="LoaderDualHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
              <security mode="None"></security>
            </binding>
          </wsDualHttpBinding>      <basicHttpBinding>
            <binding name="LoaderHttpBindingConfig"  maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                        maxReceivedMessageSize="2147483647" messageEncoding="Text">
              <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                         maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
            </binding>
          </basicHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="" name="IisServer.MyServer">
            <endpoint  binding="wsDualHttpBinding"
                bindingConfiguration="LoaderDualHttpBindingConfig" name="IisServer.MyServer"
                contract="contract.IContract" />
            
            <!--<endpoint  binding="basicHttpBinding"
        bindingConfiguration="LoaderHttpBindingConfig" name="IisServer.MyServer"
        contract="contract.IContract" />-->
          </service>
        </services>
      </system.serviceModel>客户端配置文件:
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="LoaderServiceBehavior">
              <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:9001/" />
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="LargeQuotaBehavior">
              <dataContractSerializer
                maxItemsInObjectGraph="100000" />
            </behavior>
          </endpointBehaviors>    </behaviors>
        <bindings>
          <wsDualHttpBinding>
            <binding name="LoaderDualHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" clientBaseAddress="http://CHENHUIZHONG22:8099">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
              <security mode="None"></security>
            </binding>
          </wsDualHttpBinding>      <basicHttpBinding>
            <binding name="LoaderHttpBindingConfig"  maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                        maxReceivedMessageSize="2147483647" messageEncoding="Text">
              <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                         maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
            </binding>
          </basicHttpBinding>    </bindings>    <client>
          <!--<endpoint address="http://localhost:9045/iis/IisServer.svc"
     behaviorConfiguration="LargeQuotaBehavior"
                    binding="basicHttpBinding"
              bindingConfiguration="LoaderHttpBindingConfig" contract="contract.IContract"
              name="LoaderClientHttp"/>-->
          <endpoint address="http://localhost:9045/iis/IisServer.svc" binding="wsDualHttpBinding"
              bindingConfiguration="LoaderDualHttpBindingConfig" contract="contract.IContract"
              name="LoaderClientDualHttp" />
        </client>
      </system.serviceModel>
      

  5.   

    楼主:
    我现在比你好点,能够单向成功(wsDualHttpBinding),就是不能够回调。
    开始也出现逆刚才的问题,我把用localhost的地方换成了具体的ip地址就可以实现单向功能了。