StreamSocket.ConnectAsync arroja la excepción "HRESULT: 0x8007274C" al usar una VPN

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 (when using a vpn).

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

Saludos cordiales,

Sörnt

preguntado el 12 de junio de 14 a las 10:06

What is the range of IP addresses in used by the remote network in the VPN? Is it 192.168.*.* ? -

It is 192.168.180.* . The IP-Address for my Dev PC is 192.168.180.63 when connected via vpn it is 192.168.180.222. -

Can you try by putting different range of IP addresses on each network? The TCP packets maybe are being forwarded to the remote network. -

Or a different question will be, what happen if you try to connect to 192.168.180.58 from 192.168.180.63 machine? -

Was this ever resolved? I'm having this same problem on the latest Windows 10 -

1 Respuestas

I was facing the same problem then i found that

We can not keep two app running at the same time.

If Server app is running and then run the client app, the server app will

suspend and the client app will fail with connect.

You can create a server application as a desktop app, so that the client and

server can run at the same time.

De MSDN Aquí.

respondido 18 mar '15, 10:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.