我刚刚将一个项目克隆到一台新机器上,但遇到了难以调试的问题NullReferenceException
在带有 OWIN 的 MVC 站点上:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Owin.Security.Cookies.<AuthenticateCoreAsync>d__0.MoveNext() +664
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
Microsoft.Owin.Security.Infrastructure.<BaseInitializeAsync>d__2.MoveNext() +860
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +427
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +33
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +150
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +42
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +415
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
它发生在之后
[assembly: OwinStartupAttribute(typeof(Website.Startup))]
namespace Website
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
但这是我在抛出异常后所能辨别的 F10ing - 它永远不会到达第一个控制器的构造函数。
有没有人以前经历过这种情况和/或可以指出我可能导致错误的原因?
上面的解决方案对我没有帮助,但在尝试了很多方法后我终于找到了答案。
我同时开发多个解决方案,本地主机 cookie 中一定有一些问题(每个解决方案在不同的本地主机端口上运行)。清除本地主机cookie后,问题得到解决。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)