无法从Unity游戏中嵌入的Nancy REST服务器获取POST体

the*_*oom 4 c# mono unity-game-engine nancy

我正在尝试为Nancy POST设置路由,我希望以Json格式提交一个对象,并使用它来触发Unity运行时中的事件 - 我认为这应该是相当标准的东西.

我认为通过遵循NancyFX中的示例:反序列化JSON我能够将请求的主体绑定到一个对象,然后在其他地方使用它,但是我实际上得到了这个相当神秘的错误:

Error CS1061: Type 'server.RESTServer' does not contain a definition for 'Bind' and no extension method 'Bind' of type 'server.RESTServer' could be found (are you missing a using directive or an assembly reference?) (CS1061) (server)
Run Code Online (Sandbox Code Playgroud)

这是违规来源的相关部分:

using Nancy;

namespace server
{
    public class RESTServer : Nancy.NancyModule, RESTInterface
    {
        public class LevelInfo
        {
            public string index;
        }
        public RESTServer ()
        {
            Delete ["/current/level"] = _ => 
            {
                UnloadLevel();
                return HttpStatusCode.OK;
            };
            Get ["/current/level"] = _ => Level;
            Post ["/current/level"] = _ => 
            {
                LevelInfo body = this.Bind<LevelInfo>(); //This is the offending line
                // snip rest of implementation
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的Mono/Monodevelop版本信息在这里pastebin,而Assembly Browser Nancy 显示了这个,也链接在pastebin上.

我一般不做很多.net开发,所以我确定它非常简单,但我已经失去了一个下午试图解决这个问题......任何帮助都会非常感激.

Sun*_*nov 6

Bind<>Nancy.ModelBinding命名空间中的扩展方法.

你需要 using Nancy.ModelBinding;