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
Authentication ServiceStack Redis身份验证持久性_Authentication_Redis_Persistence_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack - Fatal编程技术网 servicestack,Authentication,Redis,Persistence,servicestack" /> servicestack,Authentication,Redis,Persistence,servicestack" />

Authentication ServiceStack Redis身份验证持久性

Authentication ServiceStack Redis身份验证持久性,authentication,redis,persistence,servicestack,Authentication,Redis,Persistence,servicestack,我正在尝试学习如何在ServiceStack中使用Redis进行UserAuth持久化 我的Global.asax.cs中有以下代码: 公共类HelloAppHost:AppHostBase { public HelloAppHost():base(“helloweb服务”,typeof(HelloService.Assembly){} 公共覆盖无效配置(Funq.Container) { Register(newmemorycacheclient()); Add(新AuthFeature(()

我正在尝试学习如何在ServiceStack中使用Redis进行UserAuth持久化

我的Global.asax.cs中有以下代码:

公共类HelloAppHost:AppHostBase
{
public HelloAppHost():base(“helloweb服务”,typeof(HelloService.Assembly){}
公共覆盖无效配置(Funq.Container)
{
Register(newmemorycacheclient());
Add(新AuthFeature(()=>新AuthUserSession(),新IAuthProvider[]{
新凭据AuthProvider()
}));
容器.Register(c=>new PooledRedisClientManager(
"127.0.0.1:6379"
));
集装箱。登记(
c=>newredisauthrepository(c.Resolve());
}
}
我在TCP/6379上本地公开了Redis的默认安装/配置(来自Deb7包)

调用身份验证服务时,我收到以下错误:

响应状态
错误代码RedisResponseException
MessageZero-length-respose,sPort:65470,LastCommand:
堆栈跟踪[Auth:07/06/2013 17:29:08]:[REQUEST:{UserName:test,Password:test}]
ServiceStack.Redis.RedisResponseException:零长度响应,运动:65470,LastCommand:at
位于的ServiceStack.Redis.RedisNativeClient.CreateResponseError(字符串错误)
ServiceStack.Redis.RedisNativeClient.ParseSingleLine(字符串r)位于
ServiceStack.Redis.RedisNativeClient.ReadData()位于
ServiceStack.Redis.RedisNativeClient.SendExpectData(字节[][]cmdWithBinaryArgs)位于
ServiceStack.Redis.RedisNativeClient.HGet(字符串哈希ID,字节[]键)位于
ServiceStack.Redis.RedisClient.GetValueFromHash(字符串哈希ID,字符串键)位于
ServiceStack.ServiceInterface.Auth.RedisClientManagerFacade.RedisClientFacade.GetValueFromHash(字符串哈希ID,字符串键)位于
ServiceStack.ServiceInterface.Auth.RedisAuthRepository.GetUserAuthByUserName(IRedisClientFacade redis,字符串用户名或邮件)位于
ServiceStack.ServiceInterface.Auth.RedisAuthRepository.GetUserAuthByUserName(字符串userNameOrEmail)位于
ServiceStack.ServiceInterface.Auth.RedisAuthRepository.tryaAuthenticate(字符串用户名、字符串密码、UserAuth和UserAuth)位于
ServiceStack.ServiceInterface.Auth.CredentialAuthProvider.TryAuthenticate(IServiceBase authService、字符串用户名、字符串密码)位于
ServiceStack.ServiceInterface.Auth.CredentialAuthProvider.Authentication(IServiceBase authService、IAAuthSession会话、字符串用户名、字符串密码、字符串引用URL)位于
ServiceStack.ServiceInterface.Auth.CredentialAuthProvider.Authentication(IServiceBase authService、IAAuthSession会话、Auth请求)位于
ServiceStack.ServiceInterface.Auth.AuthService.Authenticate(身份验证请求、字符串提供程序、IAuthSession会话、IAuthProvider oAuthConfig)位于
ServiceStack.ServiceInterface.Auth.AuthService.Post(身份验证请求)位于
ServiceStack.ServiceInterface.Auth.AuthService.Get(身份验证请求)位于
ServiceStack.ServiceHost.ServiceRunner`1.Execute处的lambda_方法(闭包、对象、对象)(IRequestContext requestContext、对象实例、TRequest请求)
是什么导致了这个错误

我怀疑可能是以下原因之一:

-我是否需要以某种方式设置Redis? -我的Global.asax.cs中有错误吗? -还缺什么吗? -我完全走错方向了吗


谢谢

如果其他人有这个问题,看起来这是由于客户机和服务器之间的版本不匹配造成的(debian 7 stable软件包来自旧的2.4.x分支)。我从2.6.13源代码构建了服务器,看起来一切正常。

您能从尝试进行身份验证的盒子中点击您的redis盒子连接吗?试着只做
rediscli-h[box\u host\u name]
-p6379。它能让你进去吗?如果是这样,请尝试设置和获取一些密钥并验证其是否有效。好的,我的Redis服务器正在guest deb7 VM上运行,主机TCP/6379转发给guest TCP/6379。redis cli在来宾机上正常工作,但在使用win7x64 redis cli的主机上,服务器在发出任何命令时关闭连接:错误:服务器关闭连接这可能是版本不匹配吗?服务器:2.4.14 cli:2.6.12或端口转发是否存在网络级问题?