私は自分のサイトでASPアイデンティティフレームワークを通じてGoogleとFacebookの認証を使用していますが、両方のプロバイダの外部ログインは一定の時間に正常に動作しますが、時には、問題はからですが、アプリケーションを再起動すると正常に動作します。外部認証の失敗ASP ID OWINミドルウェア
System.NullReferenceException:オブジェクト参照がオブジェクトのインスタンスに設定されていません。 at Microsoft.AspNet.Identity.Owin.SignInManager`2.d__1d.MoveNext() ---例外がスローされた前の場所からのスタックトレースの終了--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Taskタスク)SweetNightsIn.Identity.SiteUserManager.d__14.MoveNext() ---例外がスローされた以前の場所からのスタックトレースの終わり--- でSystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(タスクのタスク) で でSystem.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(タスクタスク) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(タスクタスク) SweetNightsIn.Web.Controllers.AccountController.d__3.MoveNext()
OWINのstartup.cs
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
app.CreatePerOwinContext(IdentityDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString(AppConstants.LoginPath)
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
FacebookAuthenticationOptions facebookOptions = new FacebookAuthenticationOptions()
{
AppId = ConfigurationManager.AppSettings["FacebookAppId"],
AppSecret = ConfigurationManager.AppSettings["FacebookAppSecret"],
UserInformationEndpoint = "https://graph.facebook.com/v2.8/me?fields=id,name,email",
BackchannelHttpHandler = new FacebookBackChannelHandler()
};
facebookOptions.Scope.Add("email");
app.UseFacebookAuthentication(facebookOptions);
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = ConfigurationManager.AppSettings["GoogleAppId"],
ClientSecret = ConfigurationManager.AppSettings["GoogleAppSecret"],
Caption = "Google +"
});
、次のようになりますが、より多くの情報