我在尝试example时遇到以下异常:有人可以点亮这个吗?提前谢谢。
Exception=System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. --->
MongoDB.Driver.MongoQueryException: QueryFailure flag was not authorized
for query on MongoTest.todoItems (response was { "$err" : "not
authorized for query on MongoTest.todoItems", "code" : 13 }).
at
MongoDB.Driver.Internal.MongoReplyMessage`1.ReadHeaderFrom(BsonBuffer
buffer)
at
MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings
readerSettings, IBsonSerializer serializer, IBsonSerializationOptions
serializationOptions)
at
MongoDB.Driver.Operations.QueryOperation`1.GetFirstBatch(IConnectionProvider
connectionProvider)
at
MongoDB.Driver.Operations.QueryOperation`1.Execute(IConnectionProvider
connectionProvider)
at MongoDB.Driver.MongoCursor`1.GetEnumerator()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at
System.Web.Http.OData.Query.TruncatedCollection`1..ctor(IQueryable`1
source, Int32 pageSize)
at
System.Web.Http.OData.Query.ODataQueryOptions.LimitResults[T](IQueryable`1
queryable, Int32 limit, Boolean& resultsLimited)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object
obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at
System.Web.Http.OData.Query.ODataQueryOptions.LimitResults(IQueryable
queryable, Int32 limit, Boolean& resultsLimited)
at System.Web.Http.OData.Query.ODataQueryOptions.ApplyTo(IQueryable
query, ODataQuerySettings querySettings)
at System.Web.Http.OData.EnableQueryAttribute.ApplyQuery(IQueryable
queryable, ODataQueryOptions queryOptions)
at System.Web.Http.OData.EnableQueryAttribute.ExecuteQuery(Object
response, HttpRequestMessage request, HttpActionDescriptor
actionDescriptor)
at
System.Web.Http.OData.EnableQueryAttribute.OnActionExecuted(HttpActionExecutedContext
actionExecutedContext)
at
System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext
actionExecutedContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Filters.ActionFilterAttribute.<callonactionexecutedasync>d__5.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Filters.ActionFilterAttribute.<executeactionfilterasynccore>d__0.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Filters.ActionFilterAttribute.<callonactionexecutedasync>d__5.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Web.Http.Filters.ActionFilterAttribute.<callonactionexecutedasync>d__5.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Filters.ActionFilterAttribute.<executeactionfilterasynccore>d__0.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Controllers.ActionFilterResult.<executeasync>d__2.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Filters.AuthorizationFilterAttribute.<executeauthorizationfilterasynccore>d__2.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Controllers.AuthenticationFilterResult.<executeasync>d__0.MoveNext()
---
End of stack trace from previous location where exception was thrown
---
at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Web.Http.Controllers.ExceptionFilterResult.<executeasync>d__0.MoveNext(),
Id=bbe72ff9-c204-4e88-af31-88ee52f0c2e1, Category='App.Filters'