在门户上设置 Windows Azure Redis 连接字符串

Set Windows Azure Redis connection string on the portal

在我维护 2 个 Redis 连接的 redis 辅助方法上 strings.One 用于 local,另一个用于 Azure redis server。每次我需要发布时,我得改一下 manually.My app is ASP.net MVC (SPA) app.

问:那么在 Azure 门户上或我进行发布时是否有任何地方可以设置发布 Redis connection string

 public class RedisConnectorHelper
    {
     private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
            new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("localhost,ConnectTimeout=10000"));//local host

     //private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
     //   new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("Myredis.redis.cache.windows.net:6380,password=mypassword,ssl=True,abortConnect=False"));//production
} 

更新:

我已经在 web.config.release 文件中进行了设置,如下所示。

<connectionStrings>

    <add name="Abp.Redis.Cache" connectionString="Myredis.redis.cache.windows.net:6380,password=mypassword=,ssl=True,abortConnect=False" />

  </connectionStrings>

不过好像没捡到。你能告诉我为什么吗?

这是trick.Cheers :)

#if DEBUG
   private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
            new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("localhost,ConnectTimeout=10000"));//local host
#else
   private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
      new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("Myredis.redis.cache.windows.net:6380,password=mypassword,ssl=True,abortConnect=False"));//production
#endif