用于EnyimMemcached问题的protobuf-net转码器

时间:2012-11-30 14:08:09

标签: asp.net-mvc protobuf-net enyim.caching

从protobuf-net到enyim缓存的代码转换器是否已被弃用? distributed caching with protobuff-net

当我尝试启动MemcachedClient()时,设置我的Enyim配置就像这样app.config会导致错误 使用

也一样
  

transcoder type =“ProtoBuf.Caching.Enyim.NetTranscoder”/

System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for 'Enyim.Caching.MemcachedClient' threw an exception.
Source=Enyim.Caching
TypeName=Enyim.Caching.MemcachedClient
StackTrace:
   at Enyim.Caching.MemcachedClient..ctor()
   at Global.asax.cs:line 31
InnerException: System.Configuration.ConfigurationErrorsException
   HResult=-2146232062
   Message=The value of the property 'transcoder' cannot be parsed. The error is: Object reference   not set to an instance of an object. (\web.config line 207)
   Source=System.Configuration
   BareMessage=The value of the property 'transcoder' cannot be parsed. The error is: Object reference not set to an instance of an object.
   StackTrace:
        at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
        at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
        at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
        at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
        at System.Web.HttpContext.GetSection(String sectionName)
        at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
        at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
        at System.Configuration.ConfigurationManager.GetSection(String sectionName)
        at Enyim.Caching.MemcachedClient..cctor() in MemcachedClient.cs:line 25
   InnerException: 

两者均通过nuget安装并使用最新版本。

1 个答案:

答案 0 :(得分:3)

是(咳),当然那就是那里!只需看“protobuf-net.Enyim”,即

  

PM>安装包protobuf-net.Enyim

(或使用GUI客户端)

要初始化,您需要将代码转换器配置为ProtoBuf.Caching.Enyim.NetTranscoder的实例(根据原始说明)。如果您是通过配置执行此操作,请注意此类型的程序集现在为protobuf-net.Enyim。如果我假设配置文件使用标准表示法,那么这意味着您需要指定(在配置中):

<transcoder type="ProtoBuf.Caching.Enyim.NetTranscoder,protobuf-net.Enyim" />

原始答案:

enyim代码转换器目前不在nuget中;然而 - 我现在 通过添加一个单独的NuGet包(引用EnyimMemcached和protobuf-net)来重新获取它,然后重新加入它。

随机问题...你有机会指着我进行二进制memcached下载测试吗?

这个滞后的一个原因是,当我第一次编写了enyim代码转换器时,memcached是一个简单的“运行它” - 但上次我看起来它已经全部“企业化”了,我无法跟踪一个只有memcached服务器的简单包。如果你能告诉我那个现在的位置,我将在本周末开始工作。