在ASP.NET Core RC2中使用AddAuthentication时的模棱两可的调用

亚历克斯

我已经安装了asp.net core rc2。我正在尝试创建jwt令牌auth。在rc 1中,所有工作人员都很好。即使您创建一个标准项目,他也没有启动,因为存在错误=(纠正错误,我在startup.cs中添加了一个代码:

  public void ConfigureServices(IServiceCollection services)
    {
        // Add framework services.
        services.AddApplicationInsightsTelemetry(Configuration);
        var connection = "Data Source=DESKTOP-R3AP4AT\\SQLEXPRESS;Initial Catalog=Guide;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
        services.AddDbContext<GuideContext>(options => options.UseSqlServer(connection));
        services.AddAuthentication();
        services.AddMvc();
    }

添加project.json库:

"AspNet.Security.OpenIdConnect.Server": "1.0.0-beta4",

并且有一个错误:错误所有project.json:

    {
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",
    "Microsoft.AspNet.Authentication": "1.0.0-rc1-final",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0-rc2-final",
    "Microsoft.AspNet.Security.OpenIdConnect" :  "1.0.0-beta3" 

  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    },
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

请勿将不同的RC版本混在一起。您的project.json混合了RC1和RC2模块。

所有这些都必须是RC2,否则它将无法正常工作。从旧版本到新版本都有数十种重大更改。

"Microsoft.AspNet.Authentication": "1.0.0-rc1-final",
"Microsoft.AspNet.Security.OpenIdConnect" :  "1.0.0-beta3",
"AspNet.Security.OpenIdConnect.Server": "1.0.0-beta4"

这些行是错误的,它们已经过时了。

"Microsoft.AspNetCore.Authentication": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Authentication.OpenIdConnect" :  "1.0.0-rc2-final",
"AspNet.Security.OpenIdConnect.Server": "1.0.0-beta5-final"

应该管用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在ASP.NET Core 1.0 RC2中使用RSS的正确方法

来自分类Dev

在ASP.NET Core应用程序(RC2)中使用net451库

来自分类Dev

ASP.NET Core rc2中的Cookie

来自分类Dev

ASP.NET Core RC2中的网址重写

来自分类Dev

ASP.NET Core RC2中的网址重写

来自分类Dev

ASP Net Core 1 RC2 AccountController注入

来自分类Dev

是否发布了ASP.NET Core RC2?

来自分类Dev

无法添加对.net core类库asp.net core rc2的引用

来自分类Dev

ASP.NET Core RC2迁移-加载视图时出错

来自分类Dev

.NET Core RC2 applicationhost.config与ASP.NET .NET 4.6不兼容?

来自分类Dev

ASP.NET Core 1.0 RC2中的“找不到类型或名称空间名称”

来自分类Dev

如何禁用ASP.NET Core rc2中的浏览器缓存?

来自分类Dev

如何在ASP.NET Core 1.0 RC2中加载程序集

来自分类Dev

在ASP.NET MVC Core应用程序(RC2)中显示项目版本

来自分类Dev

无法在IISExpress中启动ASP.NET Core RC2 Web应用程序

来自分类Dev

如何在ASP.NET Core RC2中制作Websocket服务器?

来自分类Dev

如何在ASP.NET Core RC2中制作Websocket服务器?

来自分类Dev

ASP.NET Core 1.0 RC2中的“找不到类型或名称空间名称”

来自分类Dev

无法在ASP.NET Core RC2中导入Oracle Client

来自分类Dev

使用IIS从Asp Net Core RC2网站访问本地目录

来自分类Dev

使用ASP.NET Core RC2 404(而不是403)进行承载身份验证

来自分类Dev

在ASP.NET Core中使用MimeMapping

来自分类Dev

在ASP.net Core中使用BeginCollectionItem

来自分类Dev

在ASP.NET Core中使用DirectoryServices

来自分类Dev

从asp net 5迁移到asp net core时出错

来自分类Dev

ASP.NET-C#反射:在运行时,AddObject导致“模棱两可的匹配找到异常”

来自分类Dev

将Asp.Net Core RC1迁移到RC2后的问题

来自分类Dev

ASP.NET Core中的属性

来自分类Dev

ASP.Net Core中的动态路由

Related 相关文章

  1. 1

    在ASP.NET Core 1.0 RC2中使用RSS的正确方法

  2. 2

    在ASP.NET Core应用程序(RC2)中使用net451库

  3. 3

    ASP.NET Core rc2中的Cookie

  4. 4

    ASP.NET Core RC2中的网址重写

  5. 5

    ASP.NET Core RC2中的网址重写

  6. 6

    ASP Net Core 1 RC2 AccountController注入

  7. 7

    是否发布了ASP.NET Core RC2?

  8. 8

    无法添加对.net core类库asp.net core rc2的引用

  9. 9

    ASP.NET Core RC2迁移-加载视图时出错

  10. 10

    .NET Core RC2 applicationhost.config与ASP.NET .NET 4.6不兼容?

  11. 11

    ASP.NET Core 1.0 RC2中的“找不到类型或名称空间名称”

  12. 12

    如何禁用ASP.NET Core rc2中的浏览器缓存?

  13. 13

    如何在ASP.NET Core 1.0 RC2中加载程序集

  14. 14

    在ASP.NET MVC Core应用程序(RC2)中显示项目版本

  15. 15

    无法在IISExpress中启动ASP.NET Core RC2 Web应用程序

  16. 16

    如何在ASP.NET Core RC2中制作Websocket服务器?

  17. 17

    如何在ASP.NET Core RC2中制作Websocket服务器?

  18. 18

    ASP.NET Core 1.0 RC2中的“找不到类型或名称空间名称”

  19. 19

    无法在ASP.NET Core RC2中导入Oracle Client

  20. 20

    使用IIS从Asp Net Core RC2网站访问本地目录

  21. 21

    使用ASP.NET Core RC2 404(而不是403)进行承载身份验证

  22. 22

    在ASP.NET Core中使用MimeMapping

  23. 23

    在ASP.net Core中使用BeginCollectionItem

  24. 24

    在ASP.NET Core中使用DirectoryServices

  25. 25

    从asp net 5迁移到asp net core时出错

  26. 26

    ASP.NET-C#反射:在运行时,AddObject导致“模棱两可的匹配找到异常”

  27. 27

    将Asp.Net Core RC1迁移到RC2后的问题

  28. 28

    ASP.NET Core中的属性

  29. 29

    ASP.Net Core中的动态路由

热门标签

归档