
public voID ConfigureServices(IServiceCollection services) { services.AddDbContext<AppContext>(options => options.Usesqlite("Data Source=app.db")); // IDentity/Authorization Services services.AddAuthentication(sharedOptions => { sharedOptions.DefaultScheme = cookieAuthenticationDefaults.AuthenticationScheme; sharedOptions.DefaultChallengeScheme = OpenIDConnectDefaults.AuthenticationScheme; }) .AddAzureAD(options => { options.ClIEntID = Configuration["Authentication:Microsoft:ApplicationID"]; options.ClIEntSecret = Configuration["Authentication:Microsoft:Password"]; options.SignedOutCallbackPath = "/API/v1/accounts/signout"; }) .Addcookie(options => options.AccessDenIEdpath = "/API/v1/accounts/accessdenIEd"); services.AddTransIEnt<IRecognitionService,RecognitionService>(); services.AddTransIEnt<IProfileService,ProfileService>(); services.AddMvc(); } 我也尝试在路由中更改重定向URI:
[Route("API/v1/accounts/[action]")] public class AccountController : Controller { public async Task<IActionResult> AccessDenIEd() { return Unauthorized(); } [httpGet] public async Task<IActionResult> Signin() { return Challenge(new AuthenticationPropertIEs {RedirectUri = "/accessdenIEd"},AzureADDefaults.AuthenticationScheme); } }} 我似乎无法找到问题的根源,而堆栈跟踪对我来说毫无意义:
System.ArgumentNullException: Value cannot be null.Parameter name: uriString at System.Uri..ctor(String uriString) at Microsoft.AspNetCore.Authentication.AzureAD.UI.OpenIDConnectoptionsConfiguration.Configure(String name,OpenIDConnectoptions options) at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name) at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.<InitializeAsync>d__42.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvIDer.<GetHandlerAsync>d__5.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationService.<ChallengeAsync>d__11.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.<ChallengeAsync>d__54.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationService.<ChallengeAsync>d__11.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Mvc.ChallengeResult.<ExecuteResultAsync>d__14.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeResultAsync>d__20.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResultFilterasync>d__28`2.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterasync](State& next,Scope& scope,Object& state,Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeResultFilters>d__26.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__23.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next,Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__18.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__16.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMIDdleware.<Invoke>d__4.MoveNext()--- End of stack trace from prevIoUs location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDeBUGgerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMIDdleware.<Invoke>d__7.MoveNext()
我正在使用ASP.NET Core 2.1.1与MVC,Cors,Azure AD和EntityFramework
没有项目内的CSHTML,因为我们使用单独的前端(使用VueJs)
看到这个链接
https://github.com/aspnet/AADIntegration/issues/34
例如,添加
.AddAzureAD(options => { options.Instance = "https://login.microsoftonline.com"} 总结 以上是内存溢出为你收集整理的c# – Asp.Net核心挑战返回Null URI异常错误全部内容,希望文章能够帮你解决c# – Asp.Net核心挑战返回Null URI异常错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)