Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法从同一网络上的另一台计算机连接到Grapevine_C#_Rest_Grapevine - Fatal编程技术网

C# 无法从同一网络上的另一台计算机连接到Grapevine

C# 无法从同一网络上的另一台计算机连接到Grapevine,c#,rest,grapevine,C#,Rest,Grapevine,我正在VS2013中使用葡萄藤3.1.0。该项目称为ConsoleApplication1 在主机上启动服务器后,我可以从localhost:1234、127.0.0.1:1234和192.168.1.2:1234(我的机器的本地IP地址)本地访问它。但是,即使在端口转发之后,我也无法从任何机器连接到我的外部IP。此外,我无法从另一台机器连接本地IP地址,只能从主机连接 我甚至为这个程序制定了一个Windows防火墙规则,但没有用 以下代码用于服务器部分。使用Firefox尝试连接 //Prog

我正在VS2013中使用葡萄藤3.1.0。该项目称为ConsoleApplication1

在主机上启动服务器后,我可以从
localhost:1234
127.0.0.1:1234
192.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查看主机和另一台机器,我可以看出主机在尝试建立连接后从未收到任何形式的消息

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

我已经在Windows8.1和Windows7上测试了服务器

要成功运行葡萄藤,我还需要执行哪些步骤

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

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

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

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

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


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

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