提供了无效的请求URI。 (堆栈跟踪中没有有用的信息)

时间:2019-03-22 18:41:13

标签: c# asp.net .net

在这里拉我的头发。一切正常,然后我突然发现Microsoft.Owin.Security周围出现一些错误。按照此站点上的一些技巧,我卸载了该软件包以及所有依赖于该软件包的软件包(很多),然后重新安装了所有软件包。

现在,当我在调试中运行站点时,我得到了:

  

提供了无效的请求URI。请求URI必须为绝对URI或必须设置BaseAddress。

令人沮丧的是,堆栈跟踪中的任何地方都没有我可以理解的东西。我将其全部粘贴在下面。

Visual Studio 2017中的.NET 4.7.1 Web应用程序

有关如何进行故障排除的任何提示都将有所帮助。我已经删除了整个解决方案,并将其从TFS中重新拉出。使用相同源代码的队友看不到这一点。

编辑:

我唯一能遇到断点的地方是索引控制器中的构造函数。该构造函数为空。断点命中,然后即使我进行调试,下一件事就是抛出错误。如果我能准确确定导致错误的位置/原因,那会很好,但是即使那样我也遇到了麻烦。

Stack Trace: 


[InvalidOperationException: An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.]
   System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) +335995
   System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) +99
   System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken) +65
   Microsoft.IdentityModel.Protocols.<GetDocumentAsync>d__8.MoveNext() +196

[IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'.]
   Microsoft.IdentityModel.Protocols.<GetDocumentAsync>d__8.MoveNext() +662
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.IdentityModel.Protocols.OpenIdConnect.<GetAsync>d__3.MoveNext() +291
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +25
   Microsoft.IdentityModel.Protocols.<GetConfigurationAsync>d__24.MoveNext() +1129

[InvalidOperationException: IDX20803: Unable to obtain configuration from: '[PII is hidden]'.]
   Microsoft.IdentityModel.Protocols.<GetConfigurationAsync>d__24.MoveNext() +1586
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.OpenIdConnect.<ApplyResponseChallengeAsync>d__8.MoveNext() +432
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<ApplyResponseCoreAsync>d__40.MoveNext() +272
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<ApplyResponseAsync>d__39.MoveNext() +271
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<TeardownAsync>d__34.MoveNext() +158
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<Invoke>d__5.MoveNext() +659
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__7.MoveNext() +179
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<Invoke>d__5.MoveNext() +519
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<Invoke>d__5.MoveNext() +519
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__7.MoveNext() +179
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<DoFinalWork>d__12.MoveNext() +180
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +380
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159

3 个答案:

答案 0 :(得分:1)

请选中this threadthis thread。我相信您需要注意“无法从中获取配置”异常,希望这些对您有所帮助。 :)

答案 1 :(得分:1)

为了记录与PII相关的异常的其他详细信息, 尝试在ShowPII = true类的Configure方法中设置Startup,例如

Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;

这应将其他详细信息记录到输出窗口。

答案 2 :(得分:1)

我花了两天时间。问题是授权URL不正确。检查您在Azure和应用程序中设置的授权URL是否相同。

希望这对某人有所帮助。