C# 为什么我的Nancyfx谈判代表没有返回正确的模型?
我定义了以下路线:C# 为什么我的Nancyfx谈判代表没有返回正确的模型?,c#,nancy,C#,Nancy,我定义了以下路线: Get["/test"] = _ => Negotiate .WithModel(new { Name = "This is base model " }) .WithMediaRangeModel(new MediaRange("text/html"), new { Name = "This is text/html" }) .WithMediaRangeModel(new MediaRange("text/plain"), new { Nam
Get["/test"] = _ => Negotiate
.WithModel(new { Name = "This is base model " })
.WithMediaRangeModel(new MediaRange("text/html"), new { Name = "This is text/html" })
.WithMediaRangeModel(new MediaRange("text/plain"), new { Name = "This is text/plain" })
.WithView("index");
我得到的是:
Accepts header Actual response (content-type + model)
----------------- -----------------------------------------
text/html (OK) HTML view with "html" model
application/json (OK) application/json with "base" model
text/plain HTTP 406
text/* application/json with "html" model
*/* application/json with "html" model
因此:
- 如何让
模型返回“text/plain”
接受:text/plain
- 为什么要为
返回“html”模型(内容类型为*/*
)application/json