How to define connection string for session state in Azure

后端 未结 4 1377
傲寒
傲寒 2020-12-19 05:37

I am using the RedisSessionStateProvider using a procedimient like this https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-session-state-

4条回答
  •  抹茶落季
    2020-12-19 06:22

    If you just want to be able to provide your connection string from your source code, you can use the settingsClassName and settingsMethodName properties in the config, like so:

     
      
          
      
    

    In here, the settingsClassName is the name of a class in your app, with its fully qualified namespace. The settingsMethod name is the name of the method on this class, which must be static, take 0 parameters and return an string. For example:

    namespace MyApp
    {
        public static class SessionStateRedisSettings
        {
            public static string ConnectionString()
            {
                return "ConnectionString goes here";
            }
        }
    }
    

    From here: https://github.com/Azure/aspnet-redis-providers/wiki/Configuration

提交回复
热议问题