Why is [Owin] throwing a null exception on new project?

前端 未结 16 1535
孤城傲影
孤城傲影 2020-12-25 10:01

I have a rather strange issue i\'m not sure how to fix or if i can even fix it.

I\'ve done some research into the issue but can\'t find an answer to what\'s causing

16条回答
  •  半阙折子戏
    2020-12-25 10:38

    I was getting similar error but when I changed EF configuration from DropCreateDatabaseIfModelChanges< Context> to DropCreateDatabaseAlways< Context>.

    I'm not sure about cause of your error but it seems like an issue in Katana Project https://katanaproject.codeplex.com/workitem/346

    You can try workaround at above link or from https://katanaproject.codeplex.com/discussions/565294

    This is what I did in my StartUp.Auth.cs

    app.UseCookieAuthentication(new CookieAuthenticationOptions
    {
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath = new PathString("/Account/Login"),
        Provider = new CookieAuthenticationProvider
        {
               OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(
                validateInterval: TimeSpan.FromMinutes(1),
                regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)),
    
               //**** This what I did ***//
                OnException = context => { }
        }
    });
    

提交回复
热议问题