Problems registering a receiver with Microsoft Webhooks

拥有回忆 提交于 2019-12-25 09:18:24

问题


I'm trying to register a subscriber to events for using the following example. When I use the POST method, I get a bad request error (400), so I've attempted to visit the url where the request is sent and received using a browser and received the following stack trace:

When visiting

https://localhost:44300/api/webhooks/registrations

I get:

> {"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()"}}}

Based on the source code here, my understanding is that the line below is problematic

string id = await _user.GetUserIdAsync(User);

One of my guesses is that Microsoft's Webhook library requires Identity to be installed (the application where I'm testing this uses SimpleMembership).

Is this the problem? Can this be resolved easily?

来源:https://stackoverflow.com/questions/44463157/problems-registering-a-receiver-with-microsoft-webhooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!