Overide Connection for RedisSessionStateProvider on Azure

时间:2015-07-31 20:21:02

标签: c# asp.net azure redis azure-web-sites

i am using RedisSessionStateProvider with asp.net mvc 4.5 for session management. i am using azure web app for my hosting. how do i override this connection info on azure portal during prod deployment. is there any other way than using web.release.config transform file?

  <sessionState mode="Custom" timeout="2000" customProvider="MySessionStateStore">
    <providers>
      <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="server.cloudapp.net" port="6379" accessKey="password" ssl="false" databaseId="1" applicationName="pWeb" />
    </providers>
  </sessionState>

1 个答案:

答案 0 :(得分:7)

提供程序接受ConnectionString参数,该参数可以指向appsetting。您可以根据您运行的环境设置此appsetting。 以下代码显示了web.config

std::is_trivially_copyable