我正在尝试将订阅者注册到使用following示例的事件。当我使用POST方法时,我收到错误请求错误(400),因此我尝试访问使用浏览器发送和接收请求的URL并收到以下堆栈跟踪:
访问时
https://localhost:44300/api/webhooks/registrations
我明白了:
> {"message":"An error has occurred.","exceptionMessage":"General error
> during 'Get' operation: 'An error occurred while executing the command
> definition. See the inner exception for
> details.'.","exceptionType":"System.InvalidOperationException","stackTrace":"
> at
> Microsoft.AspNet.WebHooks.DbWebHookStore`2.<GetAllWebHooksAsync>d__5.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> Microsoft.AspNet.WebHooks.Controllers.WebHookRegistrationsController.<Get>d__3.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()","innerException":{"message":"An
> error has occurred.","exceptionMessage":"An error occurred while
> executing the command definition. See the inner exception for
> details.","exceptionType":"System.Data.Entity.Core.EntityCommandExecutionException","stackTrace":"
> at
> System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.<ExecuteStoreCommandsAsync>d__c.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.<ExecuteAsync>d__0`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()\r\n
> at
> System.Data.Entity.Core.Objects.ObjectContext.<ExecuteInTransactionAsync>d__3d`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<ExecuteAsyncImplementation>d__9`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()\r\n
> at
> System.Data.Entity.Core.Objects.ObjectQuery`1.<GetResultsAsync>d__e.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()\r\n
> at
> System.Data.Entity.Internal.LazyAsyncEnumerator`1.<FirstMoveNextAsync>d__0.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.<ForEachAsync>d__5`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()\r\n
> at
> System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.<ToArrayAsync>d__13`1.MoveNext()\r\n---
> End of stack trace from previous location where exception was thrown
> ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> Microsoft.AspNet.WebHooks.DbWebHookStore`2.<GetAllWebHooksAsync>d__5.MoveNext()","innerException":{"message":"An
> error has occurred.","exceptionMessage":"Invalid object name
> 'WebHooks.WebHooks'.","exceptionType":"System.Data.SqlClient.SqlException","stackTrace":"
> at
> System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__174_0(Task`1
> result)\r\n at
> System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()\r\n
> at System.Threading.Tasks.Task.Execute()\r\n--- End of stack trace
> from previous location where exception was thrown ---\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
> task)\r\n at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)\r\n at
> System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.<ExecuteStoreCommandsAsync>d__c.MoveNext()"}}}
string id = await _user.GetUserIdAsync(User);
我的一个猜测是,微软的Webhook库需要安装Identity(我正在测试它的应用程序使用SimpleMembership)。
这是问题吗?这可以轻松解决吗?