Asp.net mvc MVC5:Google登录失败

Asp.net mvc MVC5:Google登录失败,asp.net-mvc,google-oauth,owin,Asp.net Mvc,Google Oauth,Owin,我使用VS2K13(在Windows8.1 X64上)中的web向导生成了一个新的MVC5应用程序,并为该项目启用了Facebook和Google登录。在我的测试中,只有Facebook登录有效,而谷歌一直失败。我认为Microsoft.Owin中有一个bug 我在Asp.net上问了同样的问题,到目前为止还没有得到有效的答案。似乎没有人知道asp.net上的错误是什么 以下是调试输出: Exception Details: System.NullReferenceException: Obje

我使用VS2K13(在Windows8.1 X64上)中的web向导生成了一个新的MVC5应用程序,并为该项目启用了Facebook和Google登录。在我的测试中,只有Facebook登录有效,而谷歌一直失败。我认为Microsoft.Owin中有一个bug

我在Asp.net上问了同样的问题,到目前为止还没有得到有效的答案。似乎没有人知道asp.net上的错误是什么

以下是调试输出:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 197:        public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
Line 198:        {
Line 199:            var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
Line 200:            if (loginInfo == null)
Line 201:            {


 Source File:  c:\downloads\web\projects\TestMvc5\TestMvc5\Controllers\AccountController.cs    Line:  199 

Stack Trace: 



[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.Owin.Security.AuthenticationManagerExtensions.GetExternalLoginInfo(AuthenticateResult result) +189
   Microsoft.Owin.Security.<GetExternalLoginInfoAsync>d__7.MoveNext() +362
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
   TestMvc5.Controllers.<ExternalLoginCallback>d__25.MoveNext() in c:\downloads\web\projects\TestMvc5\TestMvc5\Controllers\AccountController.cs:199
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
   lambda_method(Closure , Task ) +64
   System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +37
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114
   System.Web.Mvc.Async.<>c__DisplayClass34.<BeginInvokeAsynchronousActionMethod>b__33(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3c() +117
   System.Web.Mvc.Async.<>c__DisplayClass45.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3e() +323
   System.Web.Mvc.Async.<>c__DisplayClass30.<BeginInvokeActionMethodWithFilters>b__2f(IAsyncResult asyncResult) +44
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
   System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +72
   System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9688704
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
异常详细信息:System.NullReferenceException:对象引用未设置为对象的实例。
源错误:
第197行:公共异步任务ExternalLoginCallback(字符串返回URL)
第198行:{
第199行:var loginInfo=await AuthenticationManager.GetExternalLoginInfoAsync();
第200行:if(loginInfo==null)
第201行:{
源文件:c:\downloads\web\projects\TestMvc5\TestMvc5\Controllers\AccountController.cs行:199
堆栈跟踪:
[NullReferenceException:对象引用未设置为对象的实例。]
Microsoft.Owin.Security.AuthenticationManagerExtensions.GetExternalLoginInfo(AuthenticateResult结果)+189
Microsoft.Owin.Security.d__7.MoveNext()+362
System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)+93
System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)+52
System.Runtime.CompilerServices.TaskWaiter`1.GetResult()+24
c:\downloads\web\projects\TestMvc5\TestMvc5\Controllers\AccountController.cs:199中的TestMvc5.Controllers.d_u25.MoveNext()
System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务任务)+93
System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务)+52
System.Runtime.CompilerServices.TaskWaiter.GetResult()+21
lambda_方法(闭包,任务)+64
System.Threading.Tasks.TaskHelperExtensions.ThrowIfFaulted(任务)+37
System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)+114
System.Web.Mvc.Async.c__显示类34.b__33(IAsyncResult asyncResult)+65
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)+47
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+136
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+102
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)+49
System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3c()+117
System.Web.Mvc.Async.c__显示类45.b_3e()+323
System.Web.Mvc.Async.c__显示类30.b__2f(IAsyncResult asyncResult)+44
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)+47
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+136
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+102
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)+50
System.Web.Mvc.Async.c__显示类28.b__19()+72
System.Web.Mvc.Async.c__显示Class1E.b__1b(IAsyncResult asyncResult)+185
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)+42
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+56
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)+40
System.Web.Mvc.Controller.b_u1d(IAsyncResult asyncResult,ExecuteCorerate innerState)+34
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+139
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+59
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+40
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+44
System.Web.Mvc.Controller.b_uu15(IAsyncResult asyncResult,Controller-Controller)+39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+62
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+139
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+59
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+40
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)+39
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)+39
System.Web.Mvc.MvcHandler.b_uu4(IAsyncResult asyncResult,ProcessRequestState innerState)+39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+139
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+59
System.Web.Mvc.Async.asyncResultRapper.End(IAsyncResult asyncResult,对象标记)+40
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+40
System.Web.Mvc.MvcHandler.System.Web.IHTTPassynchandler.EndProcessRequest(IAsyncResult结果)+38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+9688704
System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+155

我们也有同样的问题。我们确实发现,只有当用户没有定义firstname和lastname时,才会发生这种情况。一旦用户定义了firstname和lastname,则不会发生错误。如果您找到解决方法,我们将非常感谢您发布答案。

谢谢您的评论。您已经找到问题的原因。我将报告错误微软。