Redis Distributed session

Source: Internet
Author: User

Here are three ways to achieve:

1.harbour.redissessionstatestore, Servicestack.redis

Configure Web. config

  <sessionstateMode= "Custom"CustomProvider= "Redissessionstateprovider">      <providers>        <Clear/>        <Addname= "Redissessionstateprovider"type= "Harbour.RedisSessionStateStore.RedisSessionStateStoreProvider"Host= "localhost:6379"ClientType= "Pooled" />      </providers>    </sessionstate>

2.stackexchange.redis Redissessionstateprovider

configuration file Web. config

<sessionstateMode= "Custom"CustomProvider= "Mysessionstatestore">      <providers>        <Addname= "Mysessionstatestore"type= "Microsoft.Web.Redis.RedisSessionStateProvider"Host= "127.0.0.1"Port= "6379"AccessKey=""SSL= "true" />      </providers>    </sessionstate>

3. Custom Sessionstatestateprovider

  <sessionstateMode= "Custom"CustomProvider= "Redissessionstateprovider">      <providers>        <Clear/>        <Addname= "Redissessionstateprovider"type= "Harbour.RedisSessionStateStore.RedisSessionStateStoreProvider"Host= "localhost:6379"ClientType= "Pooled" />      </providers>    </sessionstate>

I built an MVC project test, but created an action that didn't create the corresponding view, never added a value to the Redis, thought it was misconfigured, but I thought it was too simple, when I returned a view to complete a request, to know the session change, To make a corresponding change. Take care of it.

Redis Distributed session

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.