我刚刚将一个项目克隆到一台新机器上,并在一个使用OWIN的MVC站点上获得了一个难以调试的NullReferenceException:
[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 --它永远不会到达第一个控制器的构造函数。
以前有没有人经历过这种情况和/或能指出错误的原因是什么?
发布于 2015-01-07 11:51:27
从v2升级到v3似乎解决了这个问题。
值得注意的是,所有与自有相关的包也应该更新。
发布于 2015-03-11 12:34:10
上面的解决方案并没有帮助我,但是我在尝试了很多事情之后终于找到了答案。
我同时开发了多个解决方案,一定是在localhost cookie(每个解决方案运行在不同的localhost端口上)中出现了一些问题。清除本地主机cookie后,问题就解决了。
发布于 2015-12-29 07:44:56
从owinv3.0更新到v3.1为我解决了这个问题。
https://stackoverflow.com/questions/27815532
复制相似问题