Closed riiight closed 4 years ago
Hi @riiight , I am going to try to help you with this.
Can you please confirm what is the NCache Version running in your environment? You can share a screenshot of the 'Get-NCacheVersion' command result by running it on powershell.
Hello,
I'm trying to get NCache working with my ASP.NET Core app. I've added Alachisoft.NCache.SessionSErvices via Nuget, registered it with the DI container via:
services.AddNCacheDistributedCache(options => { options.CacheName = "DevTheBeeHiveCache"; options.ExceptionsEnabled = true; });
but when I try to run and injecct the IDistributedCache I get the following error:
StructureMap.Building.StructureMapBuildException: Error while building type Alachisoft.NCache.Web.SessionState.NCacheDistributedCache. See the inner exception for details 1.) new NCacheDistributedCache(*Default of IOptions<NCacheConfiguration>*) 2.) Alachisoft.NCache.Web.SessionState.NCacheDistributedCache 3.) Instance of Microsoft.Extensions.Caching.Distributed.IDistributedCache (Alachisoft.NCache.Web.SessionState.NCacheDistributedCache)
...---> System.Configuration.Provider.ProviderException: Configuration Error: Could not load type 'ProtoBuf.Serializers.Pooling.BufferPoolBase
1' from assembly 'protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67'. ---> Alachisoft.NCache.Runtime.Exceptions.ConfigurationException: Configuration Error: Could not load type 'ProtoBuf.Serializers.Pooling.BufferPoolBase1' from assembly 'protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67'. ---> System.TypeLoadException: Could not load type 'ProtoBuf.Serializers.Pooling.BufferPoolBase
1' from assembly 'protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67'. at Alachisoft.NCache.Common.Pooling.PoolManager.CreatePool[T](ArrayPoolType poolType, Boolean growable) at Alachisoft.NCache.Caching.Cache.InitializeStoreObjectPools(PoolManager poolManager) at Alachisoft.NCache.Caching.Cache.InitializeObjectPools(Boolean createFakePool) at Alachisoft.NCache.Caching.Cache.Initialize(IDictionary properties, Boolean inProc, String userId, String password, Boolean isStartingAsMirror, Boolean twoPhaseInitialization) --- End of inner exception stack trace --- at Alachisoft.NCache.Caching.Cache.Initialize(IDictionary properties, Boolean inProc, String userId, String password, Boolean isStartingAsMirror, Boolean twoPhaseInitialization) at Alachisoft.NCache.Caching.CacheFactory.CreateFromProperties(IDictionary properties, CacheServerConfig config, ItemAddedCallback itemAdded, ItemRemovedCallback itemRemoved, ItemUpdatedCallback itemUpdated, CacheClearedCallback cacheCleared, CustomRemoveCallback customRemove, CustomUpdateCallback customUpdate, String userId, String password, Boolean isStartingAsMirror, Boolean twoPhaseInitialization) at Alachisoft.NCache.Client.CacheManager.GetCacheInternal(String cacheName, CacheConnectionOptions cacheConnectionOptions) at Alachisoft.NCache.Client.CacheManager.GetCache(String cacheName, CacheConnectionOptions cacheConnectionOptions, Boolean isClientCache, Boolean isPessimistic) at Alachisoft.NCache.Client.CacheManager.GetCache(String cacheName, CacheConnectionOptions cacheConnectionOptions, String clientCacheName, CacheConnectionOptions clientCacheConnectionOptions) at Alachisoft.NCache.Web.SessionState.NCacheDistributedCache.CheckAndInitializeCache() --- End of inner exception stack trace --- at Alachisoft.NCache.Web.SessionState.NCacheDistributedCache.RaiseException(Exception exc) at Alachisoft.NCache.Web.SessionState.NCacheDistributedCache.CheckAndInitializeCache() at Alachisoft.NCache.Web.SessionState.NCacheDistributedCache..ctor(IOptions1 options) at lambda_method(Closure , IBuildSession , IContext ) --- End of inner exception stack trace --- at lambda_method(Closure , IBuildSession , IContext ) at StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) at StructureMap.BuildSession.BuildUnique(Type pluginType, Instance instance) at StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) at StructureMap.Container.GetInstance(Type pluginType) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Could you please help? Also, I use version protobuf-net version 2.4.4 within the app (if that matters). Looks like NCache uses version 2.4.0 internally?
Thanks.