none
请问:如何操作才能让PeerChannel的示例能在外网上执行? RRS feed

  • 问题

  •  

    具体:将CustomResolver运行在向外公开了域名的服务器上,在不同的小区宽带后运行instance程序。

    CustomResolver的配置如下:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name="System.ServiceModel.PeerResolvers.CustomPeerResolverService">
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://j-long.vicp.net:4123/ServiceModelSamples/peerResolverService" />
              </baseAddresses>
            </host>
            <!-- use base address provided by the host -->
            <endpoint address="net.tcp://j-long.vicp.net:4123/ServiceModelSamples/peerResolverService"
                      binding="netTcpBinding"
                      bindingConfiguration="Binding1"
                      contract="System.ServiceModel.PeerResolvers.IPeerResolverContract" />
          </service>
        </services>
        <bindings>
          <netTcpBinding>
            <!-- You can change security mode to enable security -->
            <binding name="Binding1">
              <security mode="None"/>
            </binding>
          </netTcpBinding>
        </bindings>
      </system.serviceModel>
    </configuration>

    instance的配置如下:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

        <system.serviceModel>

          <client>
             <!-- chat instance participating in the mesh -->
             <endpoint name="ChatEndpoint"
                       address="net.p2p://chatMesh/ServiceModelSamples/Chat"
                       binding="netPeerTcpBinding"
                       bindingConfiguration="BindingCustomResolver"
                       contract="Microsoft.ServiceModel.Samples.IChat">
             </endpoint>
            
             <!-- client used to communicate with the custom resolver service -->
             <endpoint name="CustomPeerResolverEndpoint"
                       address="net.tcp://j-long.vicp.net:4123/ServiceModelSamples/peerResolverService"
                       binding="netTcpBinding"
                       bindingConfiguration="Binding3"
                       contract="Microsoft.ServiceModel.Samples.ICustomPeerResolver">
             </endpoint>
          </client>

          <bindings>
             <netPeerTcpBinding>
                <!-- Refer to Peer channel security samples on how to configure netPeerTcpBinding for security -->
                <binding name="BindingCustomResolver" port="0">
                  <security mode="None" />
                  <resolver mode="Custom">
                    <custom address = "net.tcp://j-long.vicp.net:4123/servicemodelsamples/peerResolverService"
                                    binding="netTcpBinding"
                                    bindingConfiguration="Binding3" />
                  </resolver>
              </binding>
               <binding name="BindingDefault" port="0">
                 <security mode="None"/>
                 <resolver mode="Auto"/>            
               </binding>
             </netPeerTcpBinding>

             <netTcpBinding>
                <!-- You can change security mode to enable security -->
                <binding name="Binding3">
                    <security mode="None"/>
                </binding>
             </netTcpBinding>
          </bindings>

       </system.serviceModel>

    </configuration>

    该示例在同一局域网上的多机测试能通过,就是一旦要通过外网就不行。

    而且三台机器全是XP SP3,并开启了IPV6协议。

    恳请哪位大侠指导下,不胜感激!

    2008年11月29日 15:11

全部回复

  • 晕,还是没人帮忙解决呀

    哪位大侠帮忙看看呀!
    2008年12月1日 6:24
  • 呼叫版本出来答疑啦

    2008年12月4日 7:49
  • 晕,还是没人帮忙解决呀

    哪位大侠帮忙看看呀!

    Hi,你现在问题解决了吗?
       把域名直接更改为IP地址试验一下,或许是DNS的问题
    Frank.Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    老徐的博客:http://frank_xl.cnblogs.com
    2009年7月20日 9:41
    版主
  • 我也遇到这种问题,公网和局域网内部的节点不能互相通讯

    我的案例:
    pc1  <---> 局域网1 <----(路由器+adsl)--->   internet   <----(adsl+ 路由器)--> 局域网2 <------->Server (Peer Resolvers)、 pc10、 pc20 ……

    pc10 , pc20 都能互通,但pc1 和 pc10,pc20 不能互通

    但pc1可以连接到  Peer Resolvers server

    而且,当我在pc1 通过 vpn连接到局域网2后(分配了局域网2的ip),pc1, pc10, pc20 立刻可以互联互通


    这让我感觉 CustomResolver 只能支持直连的ip,对一些需要中转,nat 都不支持
    2009年11月27日 2:15