我在Redis中遇到以下错误:
输入不是有效的Base-64字符串,因为它包含非基本64个字符,两个以上的填充字符或填充字符中的非法字符。“
任何指针都会有所帮助。
在Redis中存储数据的代码:
// Serialize DataTable to byte
object byteCachedDatatable = m_oSerializer.SerializeObject(oCacheObject);
// Add Serialized bytes to Redis and update expiration time
client.Set(sCacheKey, JsonSerializer.SerializeToString(byteCachedDatatable), new TimeSpan(0, 0, 0, (iExpiryTimeInMins * 60)));
从Redis获取数据的代码抛出异常:
using (var client = new RedisClient(m_sredisHost))
{
var values = client.GetValue(sCacheKey);
m_arrCacheData = (byte[])JsonSerializer.DeserializeFromString(values, typeof(byte[]));
// Convert value to datatable object
return m_arrCacheData;
}
存储在Redis中的数据:
AAEAAAD ///// AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YS ////////// CW ==
来自Redis的数据:
\ “AAEAAAD ///// AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YS ////////// CW == \”