Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 我的servicestack缓存服务在响应中包含额外的斜杠_C# 4.0_Redis_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack - Fatal编程技术网 servicestack,C# 4.0,Redis,servicestack" /> servicestack,C# 4.0,Redis,servicestack" />

C# 4.0 我的servicestack缓存服务在响应中包含额外的斜杠

C# 4.0 我的servicestack缓存服务在响应中包含额外的斜杠,c#-4.0,redis,servicestack,C# 4.0,Redis,servicestack,我已经使用ServiceStack创建了一个缓存的webservice public class ContentSearchService : ServiceBase<ContentSearch> { public ICacheClient CacheClient { get; set; } protected override object Run(ContentSearch request) { var cacheKey = "uni

我已经使用ServiceStack创建了一个缓存的webservice

public class ContentSearchService : ServiceBase<ContentSearch>
{
    public ICacheClient CacheClient { get; set; }

    protected override object Run(ContentSearch request)
    {


        var cacheKey = "unique_key_for_this_request2";
        return base.RequestContext.ToOptimizedResultUsingCache(this.CacheClient, cacheKey, () =>
        {
            //Delegate is executed if item doesn't exist in cache


            //Any response DTO returned here will be cached automatically
            return new ContentSearchResponse()
            {
                Contents = new List<ContentData>()
                {
                    new ContentData()
                    {
                         FileName = "testfile.jpg"
                    }
                }
            };
        });
    }
}
第二项答复:

{"Contents":[{"FileName":"testfile.jpg","Company":0,"Version":0}]}
{\"Contents\":[{\"FileName\":\"testfile.jpg\",\"Company\":0,\"Version\":0}]}
我使用Redis作为缓存


我已经查看了redis服务器,它们是用斜杠存储的。

结果表明,这与使用不同版本的ServiceStack程序集的客户端有关。我最新更新了服务器和客户机,一切正常

{\"Contents\":[{\"FileName\":\"testfile.jpg\",\"Company\":0,\"Version\":0}]}