.net core .NET核心Openiddict请求无效

.net core .NET核心Openiddict请求无效,.net-core,asp.net-core-webapi,bearer-token,openiddict,.net Core,Asp.net Core Webapi,Bearer Token,Openiddict,我在尝试在.net core 1.0.1上实现简单令牌身份验证时遇到了一个问题,我遵循了我喜欢的一个简单教程: 当我尝试向发送请求时,得到的响应是:“无效的请求”、“错误描述”:“指定的HTTP方法无效” my startup.cs: services.AddDbContext<AssistDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionS

我在尝试在.net core 1.0.1上实现简单令牌身份验证时遇到了一个问题,我遵循了我喜欢的一个简单教程:

当我尝试向发送请求时,得到的响应是:“无效的请求”、“错误描述”:“指定的HTTP方法无效”

my startup.cs:

 services.AddDbContext<AssistDbContext>(options =>
        {
            options.UseSqlServer(Configuration.GetConnectionString("AssistContext"));
        });
        services.AddScoped<AssistDbContext, AssistDbContext>();

        services.AddDbContext<DbContext>(options =>
        {
            // Configure the context to use an in-memory store.
            options.UseInMemoryDatabase();
            // Register the entity sets needed by OpenIddict.
            // Note: use the generic overload if you need
            // to replace the default OpenIddict entities.
            options.UseOpenIddict();
        });

        services.AddOpenIddict(options =>
        {
            // Register the Entity Framework stores.
            options.AddEntityFrameworkCoreStores<DbContext>();
            // Register the ASP.NET Core MVC binder used by OpenIddict.
            // Note: if you don't call this method, you won't be able to
            // bind OpenIdConnectRequest or OpenIdConnectResponse parameters.
            options.AddMvcBinders();
            // Enable the token endpoint.
            options.EnableTokenEndpoint("/api/authorization/token");
            // Enable the password flow.
            options.AllowPasswordFlow();
            // During development, you can disable the HTTPS requirement.
            options.DisableHttpsRequirement();
        });

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
           loggerFactory.AddConsole(Configuration.GetSection("Logging"));
           loggerFactory.AddDebug();

           app.UseApplicationInsightsRequestTelemetry();

           app.UseApplicationInsightsExceptionTelemetry();

           // Register the validation middleware, that is used to decrypt
           // the access tokens and populate the HttpContext.User property.
           app.UseOAuthValidation();
           // Register the OpenIddict middleware.
           app.UseOpenIddict();
           app.UseMvcWithDefaultRoute();

        }
services.AddDbContext

日志:

Microsoft.AspNetCore.Hosting.Internal.WebHost:信息:请求启动HTTP/1.1 POST应用程序/x-www-form-URL49 'dotnet.exe'(CoreCLR:clrhost):加载'C:\Users\consultoria.nuget\packages\AspNet.Security.OpenIdConnect.Extensions\1.0.2\lib\netstandard1.4\AspNet.Security.OpenIdConnect.Extensions.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'dotnet.exe'(CoreCLR:clrhost):加载'C:\Users\consultoria.nuget\packages\Microsoft.AspNetCore.WebUtilities\1.1.0-preview1-final\lib\netstandard1.3\Microsoft.AspNetCore.WebUtilities.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerMiddleware:信息:已成功从HTTP请求提取令牌请求:{ “授权类型”:“密码”, “用户名”:“测试者”, “密码”:“[出于安全原因删除]” }. 'dotnet.exe'(CoreCLR:clrhost):加载了'C:\Users\consultoria.nuget\packages\Microsoft.EntityFrameworkCore.InMemory\1.0.1\lib\netstandard1.3\Microsoft.EntityFrameworkCore.InMemory.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'dotnet.exe'(CoreCLR:clrhost):加载了'C:\Users\consultoria.nuget\packages\Remotion.Linq\2.1.1\lib\netstandard1.0\Remotion.Linq.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'dotnet.exe'(CoreCLR:clrhost):加载了'C:\Users\consultoria.nuget\packages\System.Interactive.Async\3.0.0\lib\netstandard1.0\System.Interactive.Async.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'dotnet.exe'(CoreCLR:clrhost):加载'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Diagnostics.StackTrace.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “dotnet.exe”(CoreCLR:clrhost):加载了“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Reflection.Metadata.dll”。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “dotnet.exe”(CoreCLR:clrhost):加载了“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.MemoryMappedFiles.dll”。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'dotnet.exe'(CoreCLR:clrhost):加载'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.UnmanagedMemoryStream.dll'。已跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware:错误:发生未经处理的异常:程序集“Microsoft.EntityFrameworkCore.Storage.Internal.InMemoryTransactionManager”中类型为“Microsoft.EntityFrameworkCore.InMemory”的方法“get\u CurrentTransaction”,版本=1.0.1.0,区域性=中性,PublicKeyToken=adb9793829ddae60'没有实现

System.TypeLoadException:程序集“Microsoft.EntityFrameworkCore.InMemory,Version=1.0.1.0,Culture=neutral,PublicKeyToken=adb9793829ddae60”中类型“Microsoft.EntityFrameworkCore.Storage.Internal.InMemoryTransactionManager”中的方法“get\u CurrentTransaction”没有实现。 位于Microsoft.Extensions.DependencyInjection.InMemoryServiceCollectionExtensions.AddEntityFrameworkInMemoryDatabase(iSeries收集服务) 在Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.c__显示Class4_1.b__2(Int64 k) 在System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey键,Func
2值工厂) 位于Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions) ---来自引发异常的上一个位置的堆栈结束跟踪--- 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite ConstructorCallSite,ServiceProvider提供程序) 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite ScopedCallSite,ServiceProvider提供程序) 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite ConstructorCallSite,ServiceProvider提供程序) 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite ScopedCallSite,ServiceProvider提供程序) 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite ConstructorCallSite,ServiceProvider提供程序) 位于Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite ScopedCallSite,ServiceProvider提供程序) 在Microsoft.Extensions.DependencyInjection.ServiceProvider.c\u DisplayClass16\u 0.b\u 0(ServiceProvider provider) 位于Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider提供程序,键入serviceType) 位于Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider提供程序) 在OpenIddict.OpenIddictProvider
4.d_u8.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在AspNet.Security.OpenIdCo
services.AddAuthentication(options =>
{
    options.DefaultScheme = OAuthValidationDefaults.AuthenticationScheme;
});