【问题标题】:Cannot connect to Grapevine from another computer on the same network无法从同一网络上的另一台计算机连接到 Grapevine
【发布时间】:2016-09-19 20:16:43
【问题描述】:

我在 VS2013 中使用 Grapevine 3.1.0。该项目名为 ConsoleApplication1。

在我的主机上启动服务器后,我可以从localhost:1234127.0.0.1:1234192.168.1.2:1234(我的机器的本地IP地址)在本地访问它。但是,即使在端口转发之后,我也无法从任何机器连接到我的外部 IP。此外,我无法从另一台机器连接本地 IP 地址,只能从主机连接。

我什至为该程序制定了 Windows 防火墙规则,但无济于事。

以下代码用于服务器部分。使用 Firefox 尝试连接。

//Program.cs
using System;
using System.Net;
using Grapevine.Server;

class Program
{
    static void Main(string[] args)
    {
        var server = new RESTServer(host: "*");
        server.Start();
        Console.ReadLine();
        server.Stop();
    }
}

public sealed class TestResource : RESTResource
{
    [RESTRoute]
    public void HandleAllGetRequests(HttpListenerContext context)
    {
        SendTextResponse(context, "GET is a success!");
    }
}

netstat -a 报告服务器正在侦听。尝试从同一网络上的另一台计算机连接时,我收到来自 Firefox 的超时消息。使用 Fiddler 查看主机和另一台机器,我可以看出主机在尝试建立连接后从未收到任何形式的消息。

我确保我在管理员模式下运行程序,但如果我不这样做,它会抛出异常。

我已经在 Windows 8.1 和 Windows 7 上测试了服务器。

为了成功运行 Grapevine,我还需要执行哪些额外步骤?

【问题讨论】:

  • 您在哪个版本的 Windows 上运行应用程序?
  • 我已经更新了上面的帖子。我已经在 Windows 8.1(主)和 Windows 7 上测试了服务器。
  • 您是从 Visual Studio 运行应用程序,还是作为独立的可执行文件运行?
  • 我正在运行构建默认发布配置时生成的可执行文件(ConsoleApplication1.exe,而不是 ConsoleApplication1.vshost.exe)。

标签: c# rest grapevine


【解决方案1】:

我什至为程序制定了 Windows 防火墙规则

您是否为 端口 制定了 Windows 防火墙规则?如果没有,try this first。您可能需要将 url 添加到运行它的计算机上的 ACL,您可以通过以管理员身份打开终端并运行来做到这一点:

netsh http add urlacl url=http://*:1234/ user=Everyone

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    • 2012-03-01
    • 2020-11-28
    • 1970-01-01
    • 2015-03-13
    • 2017-09-22
    • 1970-01-01
    相关资源
    最近更新 更多