Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.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# ASP.NETWebAPI帮助页示例生成_C#_Asp.net Mvc_Asp.net Web Api - Fatal编程技术网

C# ASP.NETWebAPI帮助页示例生成

C# ASP.NETWebAPI帮助页示例生成,c#,asp.net-mvc,asp.net-web-api,C#,Asp.net Mvc,Asp.net Web Api,我正在为WebApi使用ASP.net帮助页。在我的一些响应格式示例中,我收到了与格式化程序有关的错误。我看过各种教程,它们似乎都展示了如何覆盖表单url编码格式。我没有找到任何可以覆盖其他格式的内容: application/json、text/json、text/html、application/xml、text/xml 为了设置我使用的特定类型的样本 config.SetSampleForType("MessageGoesHere", new MediaTypeHea

我正在为WebApi使用ASP.net帮助页。在我的一些响应格式示例中,我收到了与格式化程序有关的错误。我看过各种教程,它们似乎都展示了如何覆盖表单url编码格式。我没有找到任何可以覆盖其他格式的内容:

application/json、text/json、text/html、application/xml、text/xml

为了设置我使用的特定类型的样本

 config.SetSampleForType("MessageGoesHere", new 
         MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(TypeGoesHere));
这为表单编码响应格式设置了样本。我尝试用application/json或其他示例替换MediaTypeHeader值,但没有效果


我的问题:如何为ASP.net帮助页上其他形式的URL编码的响应格式设置示例?

我遇到的问题是,我没有在typeof参数中使用确切的类型。当我应该使用IQueryable时,我正在使用一个通用集合

config.SetSampleForType("MessageGoesHere", new 
     MediaTypeHeaderValue("application/json"), typeof(ExactTypeGoesHere));