使用NancyFX,自托管和单声道的浏览器中的奇怪响应

时间:2016-10-07 11:04:22

标签: mono nancy self-hosting

这是我的测试代码:

public class MyModule : NancyModule
{
  public MyModule()
  {
    Get["/resources/{resourceId}"] = x =>
    {
      var kurt = (string)x.resourceId;
      return Response.AsText(kurt);
    };
  }
}

class Program
{
  static void Main(string[] args)
  {
    using (var host = new NancyHost(new Uri("http://localhost:1234")))
    {
      host.Start();
      Console.WriteLine("Running on http://localhost:1234");
      Console.ReadLine();
    }
  }
}

当我从VS运行它时,它按预期工作,但是当我使用mono.exe托管.exe时,我在浏览器中得到了这个:

P/1.1 200 OK
Content-Type: text/plain
Server: Mono-HTTPAPI/1.0
Date: Fri, 07 Oct 2016 10:58:32 GMT
Transfer-Encoding: chunked
Keep-Alive: timeout=15,max=100

4
test
0

似乎浏览器理解响应头。但为什么呢?

0 个答案:

没有答案
相关问题