none
Wcf over the Internet?

    Question

  • Hello all,

    I am trying to develop a Wcf chat system and I found a nice Wcf chat sample on the Internet, but although the author claims that it's a serverless solution and it worlks over the Internet, I cannot get it to work as such.

    If I run 2 or more instances of the program on my PC or on any PC on my home network, it works. But if I send this to say a friend and we both try to connect over the Internet, it will not. It just stays there saying trying to connect, stand by.

    The sample is this one:

    http://www.codeproject.com/KB/WCF/WPFWCF_Chat_App_via_P2P.aspx

    The app.config file is coded like this:

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

        <client>
          <!-- chat instance participating in the mesh -->
          <endpoint name="WPFChatEndpoint"
                    address="net.p2p://WPFChatMesh/rolandrodriguez.net/wpfchat"
                    binding="netPeerTcpBinding"
                    bindingConfiguration="WPFChatBinding"
                    contract="WPFChatViaP2P.IChat">
          </endpoint>
        </client>
        <bindings>
          <netPeerTcpBinding>
            <binding name="WPFChatBinding" port="0">
              <resolver mode="Auto"/>
              <security mode="None"/>
            </binding>
          </netPeerTcpBinding>
        </bindings>
      </system.serviceModel>
    </configuration>


    Could it be something wrong in the app.config file? The link above has both a demo and source code, in case someone has the time to check it out. Thanks in advance. I would really appreciate any help on this.

    Saturday, March 22, 2008 3:18 AM

All replies

  • I have a feeling that it has something to do with enabling Global Cloud on the client computer, but how to do this, I have NO idea.
    Saturday, March 22, 2008 4:05 AM
  • Anyone?
    Saturday, March 22, 2008 6:28 PM
  •  

    Hi, All:

     

    By an education guess, P2P chat is not possible without using a server if your machines are networked within different domains that can not be trusted with each other. Your friend machine and your machines are located within different domains. Therefore, your problem is very understandable.

     

    However, if you set up a server, chat is deadly simple as shown in many samples.

     

    Bi-directional asynchronous real-time notification

     

    Cross-browser Instant Message and Remote JavaScript Callback

     

     

    Saturday, March 22, 2008 7:17 PM
  •  msdn_msg wrote:

     

    Hi, All:

     

    By an education guess, P2P chat is not possible without using a server if your machines are networked within different domains that can not be trusted with each other. Your friend machine and your machines are located within different domains. Therefore, your problem is very understandable.

     

    However, if you set up a server, chat is deadly simple as shown in many samples.

     

    Bi-directional asynchronous real-time notification

     

    Cross-browser Instant Message and Remote JavaScript Callback

     

     



    I don't get it. From what I have gathered around the forums and the Internet, it seems that it is indeed possible to do P2P over the Internet without a server, by using PNRP. Apparently, one would use the IPv6 servers provided by Microsoft as the global cloud to provide the access point for all P2P using your chat client, but this is where I am stuck. I just can't seem to be able to get my PC to "access" the Global Cloud scope.

    Am I making sense or do I have it all wrong? This is so frustrating because at the moment, my app is working perfectly but it's useless since it can't work over the Internet.
    Sunday, March 23, 2008 12:48 AM
  • Hello all-

    HondaCop asks a great question.  I have experienced exactly the same situation with a variety of WCF P2P sample applications, including the one above and the PictureViewer example from MSDN (http://msdn.microsoft.com/en-us/magazine/cc188685.aspx). 

    While a number of forum posts have said that "serverless P2P over the Internet" using WCF should be possible, I for the life of me cannot get it to work.  In my example, which is probably common to HondaCop and everyone else, there are two PC's connected to routers that are distantly separated across the Internet.  Indeed I suspect this is the most interesting scenario for a lot of developers out there.

    I have registered both machine names in the global cloud using netsh, and have enabled IPv6 on both, and can indeed both resolve and ping each machine from the other (thus they are, as far as netsh is concerned, "peers", right?).  While every sample app works fine on an individual LAN, they all fail to see the peer when attempted across the Internet.

    Can someone from Microsoft please advise us: is this scenario supposed to be supported?  If not then is there a sample describing how this scenario would be addressed (using a server etc.)?

    Thanks.

    -Rolf
    Thursday, January 08, 2009 9:56 PM
  • I'm going to refer you guys to this thread where this very issue is discussed in more detail:

    Additionally, with the advent of the Windows Azure platform comes the Internet Service bus, which may enable the solution you're striving for.

    No magic bullet yet, but I hope this helps.



    Friday, January 09, 2009 7:25 PM
  • Will- Thanks for the link.

    For everyone else on the thread, I finally *was* able to get that particular app described by the OP to work across the internet.  I had been trying to connect two Vista machines to no avail.  It turns out that there was, sometime in 2007, some security hole patched - see details in the 10/17/2007 post here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2259451&SiteID=1

    By manually allowing "edge traversal" in the firewall rule, everything suddenly worked for me.  I don't know if this affects XP as well.

    Hope this helps someone.

    -Rolf
    Sunday, January 11, 2009 6:26 PM
  • Hi Rolf,

    I could not access your link (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2259451&SiteID=1).

    I also try to connect two client from internet. I even disabled firewall but I could not make a connection.

    Thank you for any help.

    Regards,
    Monday, November 16, 2009 2:38 AM
  • Remember firewalls are on both ends !!
    Monday, November 16, 2009 10:19 PM
  • Hello Hassanh,

    Yes, I am sure.
    From netsh command, I can ping follow context (netsh p2p pnrp diagnostics> ping host 2001:0.... Globa_)
    *BUT* I still not make a connection.

    Now my clients behind router with NAT and without firewall at all.


    What's wrong in my configuration?

    Thanks for any help.

    Regards,
    Tuesday, November 17, 2009 7:36 AM
  • Here is more information about cloud status.

    BODY { MARGIN: 8px } .LW-yrriRe { FONT: x-small arial }

    Windows 7 - Ultimate version

    netsh p2p pnrp cloud>show list

    Scope  Id     Addr   State             Name
    -----  -----  -----  ----------------  -----
        3     11      1  Alone              LinkLocal_ff00::%11/8
        1      0      1  Active            Global_
     
     
    Windows XP Pro SP3
    netsh p2p pnrp cloud>show list
    Scope  Id     Addr   State             Name
    -----  -----  -----  ----------------  -----
        3      4      1  Alone              LinkLocal_{00337E01-4339-4B87-970B-8C43D6404159}
        1      0      1  Active            Global_


    Thanks
    Tuesday, November 17, 2009 7:45 AM
  • Alexwpf-

    The forum post link got moved apparently.  Here it is now:  http://social.msdn.microsoft.com/forums/en-US/peertopeer/thread/2b0f1217-8740-4dbb-a62c-a39cc1b6c760/


    Good luck. 

    Microsoft folks - I think this issue really should have been better documented because P2P-across-the-internet is a much more interesting scenario than two PC's on the same LAN.

    -Rolf
    Thursday, February 04, 2010 12:57 AM
  • Alexwpf-

    The forum post link got moved apparently.  Here it is now:  http://social.msdn.microsoft.com/forums/en-US/peertopeer/thread/2b0f1217-8740-4dbb-a62c-a39cc1b6c760/


    Good luck. 

    Microsoft folks - I think this issue really should have been better documented because P2P-across-the-internet is a much more interesting scenario than two PC's on the same LAN.

    -Rolf


    Anyone got anything new since then?

    I just tried above samples recently and still no luck. I disabled firewall on both sides.

    Wednesday, November 03, 2010 9:36 PM
  • Hi all, I am using wcf duplex for chat app over the internet by NetTcpBinding . But i wonder, Is it possible if i set firewall on the both sides( server and client)

    Thanks so much

     

    Monday, July 04, 2011 3:36 AM