2016-05-17 44 views
0

Redisヘルパーメソッドでは、2つのRedis接続文字列を保持しています.1つはlocal、もう1つはAzure redis serverです。それぞれと公開する必要があるたびに手動で変更する。私のアプリはASP.net MVC(SPA)アプリです。ポータルでWindows Azure Redis接続文字列を設定する

Q: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> 

しかし、それは選ばれていないようです。理由を教えてください。ここで

enter image description here

+0

アプリケーションがデプロイされた方法 - Webアプリケーション、クラウドサービスやVMで? –

+0

@ GauravMantri 'Web Apps' – Sampath

+0

web.configの変換を見て、適切な接続文字列をweb.config.releaseファイルに置くことができます。したがって、アプリケーションが「リリース」モードで構築されると、そこから正しい接続文字列が取り出されます。 –

答えて

0

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 
関連する問題