本文介绍了Request.CreateErrorResponse在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此博客帖子,但实际上并没有说明如何启用"它.而且似乎默认情况下未启用它.

I saw it in this blog post, but that doesn't actually say how to "enable" it. And it seems that by default it isn't enabled.

我知道这是一种扩展方法,定义如下: http://msdn.microsoft.com/en-us/library/hh835786(v = vs.108).aspx ,但是我如何获得它呢?如果我键入 Request.CreateErrorResponse ,则编译器无法识别它.

I know it's an extension method, as defined here: http://msdn.microsoft.com/en-us/library/hh835786(v=vs.108).aspx but how do I get access to it? If I type Request.CreateErrorResponse then the compiler doesn't recognize it.

我已经在使用System.Net.Http .

I'm already using System.Net.Http.

推荐答案

您仍在使用预发行版还是发行版?许多扩展直到发行版才出现,并且在早期版本的webapi中不存在.我不确定这是否是其中之一,但这可能是导致您出现问题的原因.

Are you still using pre-release or release version? There were a number of extensions that did not appear until just before the release and did not exist in earlier versions of the webapi release. I am unsure if this was one of them, but it may be what is causing your problem.

这篇关于Request.CreateErrorResponse在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:43