' AllowAnonymous'找不到 [英] 'AllowAnonymous' could not be found

查看:91
本文介绍了' AllowAnonymous'找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切正常,直到我安装了(Package Manager控制台)邮政包裹,然后卸载并安装了旧版本.

Everything worked fine until I installed (Package Manager Console) the postal package, then uninstalled and installed an older version.

现在我收到一个错误,以前不是.错误:

Now I get an error where it previously was not. Error:

找不到类型或名称空间名称"AllowAnonymous"(您是否缺少using指令或程序集引用?)

谁知道该如何解决?

推荐答案

可能您的项目中缺少对 System.Web.Http 程序集的引用?

Probably you are missing the reference to System.Web.Http assembly in your project?

所以您需要:

  • 将引用添加到 System.Web.Http ;
  • 使用System.Web.Http;将添加到您的控制器中;

要添加参考,您需要执行以下步骤:

To add Reference you need to do next steps:

  • Solution Explorer 中,右键单击项目节点,然后单击添加.参考.
  • 添加引用"对话框中,选择程序集"标签,然后在右侧的搜索中输入 System.Web.Http .
  • 选择组件 System.Web.Http ,然后单击确定".
  • In Solution Explorer, right-click the project node and click Add Reference.
  • In the Add Reference dialog box, select the tab Assemblies, and enter System.Web.Http into search on the right side.
  • Select the component System.Web.Http, and then click OK.

链接:

如何:使用添加引用"对话框添加或删除引用框

这篇关于' AllowAnonymous'找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆