locked
StreamSocket.ConnectAsync throws Exception "HRESULT: 0x8007274C" while using a VPN

    Question

  • Hi there,

    the problem: While not using a VPN, the code below works fine. As soon as I connect to my home network via a VPN the code throws an exception (translated from german):

    A connection attempt failed because the connected party did not properly respond after a certain period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C).

    The target "192.168.180.58" is an another computer within my home network.

    Windows Store test code:

     private async void createConnection(object sender, RoutedEventArgs e)
        {
          HostName target = new HostName("192.168.180.58");
          string port = "8181";
          using (StreamSocket client = new StreamSocket())
          {
            try
            {
              await client.ConnectAsync(target, port);
            }
            catch (Exception ex)
            {
              string typeName = ex.GetType().Name;
              string msg = ex.Message;
            }
          }
        }

    I created a Windows Console Program (.NET 4.5.1) that is working in both situations (connected by using vpn and not using a vpn).

    Windows Console test code:

    namespace caPing
    {
      class Program
      {
        static void Main(string[] args)
        {
          string target = "192.168.180.58";
          int port = 8181;

          TcpClient client = new TcpClient();
          try
          {
            client.Connect(target, port);
            client.Close();
          }
          catch (Exception ex)
          {
            Console.WriteLine(ex.Message);
            throw;
          }
        }
      }
    }

    It looks like that the problem is somehow related to the execution environment for Windows Store Apps.

    What is the problem here and how can I solve it?

    Kind regards,

    Sörnt

    Thursday, June 12, 2014 3:46 PM

All replies

  • Hi there,

    [Update]
    I just noticed that this is the wrong form. I reposted the quest:
    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/5eb6ec07-0af5-4a92-a972-abe4da50873d/streamsocketconnectasync-throws-exception-hresult-0x8007274c-while-using-a-vpn?forum=winappswithcsharp

    the problem: While not using a VPN, the code below works fine. As soon as I connect to my home network via a VPN the code throws an exception (translated from german):

    A connection attempt failed because the connected party did not properly respond after a certain period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C).

    The target "192.168.180.58" is an another computer within my home network.

    Windows Store test code:

     private async void createConnection(object sender, RoutedEventArgs e)
        {
          HostName target = new HostName("192.168.180.58");
          string port = "8181";
          using (StreamSocket client = new StreamSocket())
          {
            try
            {
              await client.ConnectAsync(target, port);
            }
            catch (Exception ex)
            {
              string typeName = ex.GetType().Name;
              string msg = ex.Message;
            }
          }
        }

    I created a Windows Console Program (.NET 4.5.1) that is working in both situations (connected by using vpn and not using a vpn).

    Windows Console test code:

    namespace caPing
    {
      class Program
      {
        static void Main(string[] args)
        {
          string target = "192.168.180.58";
          int port = 8181;

          TcpClient client = new TcpClient();
          try
          {
            client.Connect(target, port);
            client.Close();
          }
          catch (Exception ex)
          {
            Console.WriteLine(ex.Message);
            throw;
          }
        }
      }
    }

    It looks like that the problem is somehow related to the execution environment for Windows Store Apps.

    What is the problem here and how can I solve it?

    Kind regards,

    Sörnt



    Thursday, June 12, 2014 7:26 AM
  • did you enabled local network access in your manifest file?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Thursday, June 12, 2014 8:15 AM
  • At the manifest file the following options are enabled:

    * Internet Client
    * Internet (Client & Server)
    * Private Networks (Client & Server)

    I guess with "local network access" you refere to the option "Private Networks (Client & Server)" - right?

    The IP-Address for my Dev PC:
    * when connection directly: 192.168.180.63
    * when using the VPN: 192.168.180.222

    In both cases that is a local (private Network).

    Thursday, June 12, 2014 8:37 AM
  • Some help is much appreciate!

    Sörnt

    Friday, June 13, 2014 4:37 AM
  • Bump
    Sunday, June 15, 2014 1:11 PM
  • Is there no one who has a Windows Store App that uses a VPN?

    I really need to get my App working by using a VPN - It is remarkable that a normal Console Application is working fine while a Windows Store App not.

    Any help is much appreciated!

    Sörnt


    • Edited by Soernt Wednesday, June 18, 2014 5:58 AM
    Tuesday, June 17, 2014 3:25 PM