升级 RavenDb 客户端后"No component for supporting the service System.Net.Http.HttpMessageHandler was foun



我有一个ASP.NET MVC 4 Web应用程序,它使用Ravendb客户端版本2.5.2879,我想将其升级到版本3.0.30143。使用nuget升级后,解决方案构建,但是当我运行应用程序时,此行会引发异常

IndexCreation.CreateIndexes(typeof(xxxxCoreInstaller).Assembly, documentStore);

抛出的例外是

No component for supporting the service System.Net.Http.HttpMessageHandler was found
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
   at Castle.Facilities.TypedFactory.TypedFactoryComponentResolver.Resolve(IKernelInternal kernel, IReleasePolicy scope)
   at Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Resolve(IInvocation invocation)
   at Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Intercept(IInvocation invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.Func`1Proxy.Invoke()
   at Raven.Client.Util.HttpClientCache.GetClient(TimeSpan timeout, OperationCredentials credentials, Func`1 handlerFactory) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightUtilHttpClientCache.cs:line 110
   at Raven.Client.Connection.Implementation.HttpJsonRequest..ctor(CreateHttpJsonRequestParams requestParams, HttpJsonRequestFactory factory) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionImplementationHttpJsonRequest.cs:line 152
   at Raven.Client.Connection.HttpJsonRequestFactory.CreateHttpJsonRequest(CreateHttpJsonRequestParams createHttpJsonRequestParams) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionImplementationHttpJsonRequestFactory.cs:line 86
   at Raven.Client.Connection.Async.AsyncServerClient.<>c__DisplayClassde.<<GetIndexAsync>b__dd>d__e0.MoveNext() in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionAsyncAsyncServerClient.cs:line 699
--- 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 Raven.Client.Connection.ReplicationInformerBase`1.<TryOperationAsync>d__29`1.MoveNext() in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionReplicationInformerBase.cs:line 443
--- 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.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Raven.Client.Connection.ReplicationInformerBase`1.<ExecuteWithReplicationAsync>d__19`1.MoveNext() in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionReplicationInformerBase.cs:line 338
--- 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 Raven.Client.Connection.Async.AsyncServerClient.<ExecuteWithReplication>d__2d1`1.MoveNext() in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionAsyncAsyncServerClient.cs:line 0
--- 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 Raven.Abstractions.Util.AsyncHelpers.<>c__DisplayClassb`1.<<RunSync>b__8>d__d.MoveNext() in c:BuildsRavenDB-Stable-3.0Raven.AbstractionsUtilAsyncHelpers.cs:line 75
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Raven.Abstractions.Util.AsyncHelpers.RunSync[T](Func`1 task) in c:BuildsRavenDB-Stable-3.0Raven.AbstractionsUtilAsyncHelpers.cs:line 90
   at Raven.Client.Connection.ServerClient.GetIndex(String name) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightConnectionServerClient.cs:line 223
   at Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightIndexesAbstractIndexCreationTask.cs:line 293
   at Raven.Client.DocumentStoreBase.ExecuteIndex(AbstractIndexCreationTask indexCreationTask) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightDocumentStoreBase.cs:line 103
   at Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightIndexesIndexCreation.cs:line 155
   at Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly assemblyToScanForIndexingTasks, IDocumentStore documentStore) in c:BuildsRavenDB-Stable-3.0Raven.Client.LightweightIndexesIndexCreation.cs:line 43

我不知道为什么会发生这种情况和搜索对此特定错误没有产生。

事实证明,这是一个与Ravendb和Castle Windsor之间相互作用相关的非常具体的问题。我在这里问了一个新问题:

我如何使用Castle Windsor与客户端版本&gt;3.0.3660?

最新更新