Alachisoft / NCache

NCache: Highly Scalable Distributed Cache for .NET
http://www.alachisoft.com
Apache License 2.0
647 stars 123 forks source link

OSS: TypeLoadException: Could not load typeProtoBuf.Serializers.Pooling.BufferPoolBase #72

Open nfMalde opened 2 years ago

nfMalde commented 2 years ago

Hello! Im using the docker image opensource-server-5.0.4 from your dockerhub and Im extending it by my own dockerfile to load my config into the container.


# Setting base image for NCache.
FROM alachisoft/ncache:opensource-server-5.0.4 as ncache
RUN dir
# Entry point for the container, once all the required configurations have been made.
ADD configs .  
RUN xcopy /s client.ncconf "C:\\Program Files\\NCache\\config" /Y
RUN xcopy /s config.ncconf "C:\\Program Files\\NCache\\config" /Y

CMD start -Verbose

Its assembled into an docker-compose env. bound to the host ncachestore my Web-Application (.net 6, using nuget package NCache.Microsoft.Extensions.Caching.OpenSource/5.0.4.1) is linked to it.

My configs look like that:

config.ncconf

<configuration>
    <cache-config cache-name="test" alias="" config-id="79bf25d2-e579-4571-bda8-93d3e9502e00" config-version="0">
        <cache-settings inproc="True" last-modified="">
            <logging enable-logs="True" trace-errors="True" trace-notices="False" trace-warnings="False" trace-debug="False" log-path=""/>
            <performance-counters enable-counters="True" snmp-port="0"/>
            <data-load-balancing enabled="False" auto-balancing-threshold="60%" auto-balancing-interval="30sec"/>
            <client-death-detection/>
            <client-activity-notification enabled="False" retention-period="5sec"/>
            <cache-notifications expiration-time="15sec"/>
            <cleanup interval="15sec"/>
            <storage type="heap" cache-size="1024mb"/>
            <eviction-policy enabled-eviction="True" default-priority="normal" eviction-ratio="5%"/>
            <cache-topology topology="local-cache"/>
        </cache-settings>
    </cache-config>
</configuration>

client.ncconf


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <ncache-server connection-retries="5" retry-connection-delay="0" retry-interval="1" client-request-timeout="90" connection-timeout="5" port="9800" />
    <cache id="test" enable-client-logs="False" log-level="error">
        <server name="ncachestore"/>
    </cache>
</configuration>

Usage in my webaplication:

Startup.cs - NET 6 (.net core)

services.AddNCacheDistributedCache(configuration =>
            {

                configuration.CacheName = "test";
                configuration.EnableLogs = true;
                configuration.ExceptionsEnabled = true;

            });

When starting the env the ncache server starts correctly and i can see output for Get-NCacheVersion

Get-NCacheVersion
Alachisoft (R) NCache Utility Get-NCacheVersion Cmdlet. Version NCache Open Source 5.0 SP4
Copyright (C) Alachisoft 2020. All rights reserved.

After warmup and loaded the following error appears: ProviderException: Configuration Error: Could not load type 'ProtoBuf.Serializers.Pooling.BufferPoolBase1' from assembly 'protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67'.`

I found an other issue regarding this error but it was closed since no activity of the info the creator needed to provide (https://github.com/Alachisoft/NCache/issues/52)

Dan-Ahmed commented 2 years ago

@nfMalde, please confirm if your application is using Protobuf for its operations. If so, share the exact version and I will look into this.