相关疑难解决方法(0)

什么是NullReferenceException,我该如何解决?

我有一些代码,当它执行时,它抛出一个NullReferenceException,说:

你调用的对象是空的.

这是什么意思,我该怎么做才能解决这个错误?

.net c# vb.net null nullreferenceexception

1876
推荐指数
24
解决办法
127万
查看次数

Owin的NullReferenceException

我刚刚将一个项目克隆到一台新机器上,并且我在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
Run Code Online (Sandbox Code Playgroud)

它发生在之后

[assembly: OwinStartupAttribute(typeof(Website.Startup))]
namespace Website
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是在我抛出异常之后,这就像我可以辨别为F10ing一样 - 它永远不会到达第一个控制器的构造函数.

有没有人经历过这个和/或能指出我可能导致错误的方向?

c# owin asp.net-mvc-5

5
推荐指数
2
解决办法
2783
查看次数

标签 统计

c# ×2

.net ×1

asp.net-mvc-5 ×1

null ×1

nullreferenceexception ×1

owin ×1

vb.net ×1