【问题标题】:asp.net 5 using DNX使用 DNX 的 asp.net 5
【发布时间】:2016-02-22 14:53:16
【问题描述】:

我在尝试在 project.json 中包含以下内容时遇到了问题:

"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",

它给了我以下错误:

TestApp项目中的依赖Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3不支持框架DNX,Version=v4.5.1

还有:

TestApp项目中的依赖Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3不支持框架DNXCore,Version=v5.0

这些是我指定的框架:

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

这是我完整的依赖列表:

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Security.Cookies": "1.0.0-beta2",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
    "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
    "Microsoft.Framework.Logging": "1.0.0-beta7",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta8",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
  },

所以问题是,如果不支持“cookies”,我可以用什么代替?,我试图环顾四周,但没有任何运气。

我想为我正在构建的一个小应用程序添加安全性,任何更好的建议将不胜感激。

【问题讨论】:

  • "Microsoft.AspNet.Securitu" 可能拼写不正确。您还有一个非常奇怪的 beta2、beta4、beta5、beta7、beta8 和 rc1-final 组合,这可能会造成一些麻烦。
  • 替代方案可能是使用 BearerToken 使用 OWIN/OAUTH OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/authtoken"), AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),提供者 = 新的 SimpleAuthorizationServerProvider() };

标签: cookies asp.net-web-api asp.net-core dnx50


【解决方案1】:

您所做的事情有几处不正确:

  1. 您正在混合使用 beta2、beta4、beta5、beta8 和 rc1 软件包。由于版本之间存在大量流失,因此这是灾难的根源。尽量坚持单一版本(rc1 是最新的稳定版)。
  2. Microsoft.AspNet.Security.* has been renamed。如果您有其他软件包找不到 rc1 版本,请搜索 Announcements 存储库以查看它们是否已重命名。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-20
    相关资源
    最近更新 更多