小道消息示例 REST 服务器代码 returns 一个 "Not found" 响应

Grapevine sample REST server code returns a "Not found" response

我想通过浏览器使用 Grapevine Plus and am following the examples provided on the wiki. I installed Grapevine Plus 3.0.4 via NuGet. I'm running the following code, but when I navigate to http://localhost:1234 实现一个简单的 REST 服务器,或者如果我通过 REST 客户端浏览器插件发送 GET 请求,我得到的只是一个 "Not found" 回复:

// Program.cs
static void Main(string[] args)
{
    var server = new RESTServer();
    server.Start();

    Console.WriteLine("Press Enter to Continue...");
    Console.ReadLine();
    server.Stop();
}

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

我错过了什么?

由于您编写的代码看起来不错(对我来说仍然运行良好),我认为您可能 运行 与 this project naming issue in Grapevine 3.0.x.

这在版本 3.1.0 中不再是一个问题,但对于较旧的 3.0.x 版本,您需要确保不包含单词 'grapevine' 在您的程序集名称中。