gpt4 book ai didi

asp.net-mvc - 无法在 MVC 应用程序中配置 Redis 缓存

转载 作者:可可西里 更新时间:2023-11-01 11:37:53 25 4
gpt4 key购买 nike

我是 Azure Redis 缓存的新手。我刚刚在 Azure 门户中配置了 Redis 缓存。我已经通过 nuget 在我的项目中安装了 StackExchange.Redis。下面是连接Redis的代码

ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("server.redis.cache.windows.net,ssl=true,password=primary access key");

IDatabase cache = connection.GetDatabase();

连接时出现以下错误:

JIT Compiler encountered an internal limitation.

at StackExchange.Redis.ConfigurationOptions.OptionKeys.TryNormalize(String value)
at StackExchange.Redis.ConfigurationOptions.DoParse(String configuration, Boolean ignoreUnknown) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConfigurationOptions.cs:line 501
at StackExchange.Redis.ConfigurationOptions.Parse(String configuration) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConfigurationOptions.cs:line 279
at StackExchange.Redis.ConnectionMultiplexer.CreateMultiplexer(Object configuration) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 728
at StackExchange.Redis.ConnectionMultiplexer.<>c__DisplayClass24.<Connect>b__23() in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 745
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 761
at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 745
at App.Web.Controllers.HomeController.Index() in g:\Users\Workspaces\AlphaProject\App.Web\Controllers\HomeController.cs:line 42
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.ActionInvocation.InvokeSynchronousActionMethod()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()

请建议我一些连接 Redis 服务器的解决方案。

提前致谢。

最佳答案

您能否尝试使用控制台应用程序连接到 Redis 缓存来隔离问题,看看是否有效?您也可以引用此示例在MVC中使用Redis缓存http://azure.microsoft.com/blog/2014/06/05/mvc-movie-app-with-azure-redis-cache-in-15-minutes/

关于asp.net-mvc - 无法在 MVC 应用程序中配置 Redis 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29506331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com