1. <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" ></sessionState>

  2. 打开注册表,运行cmd/regedit,找到节点HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\aspnet_state\Parameters

      a.将AllowRemoteConnection值设置为1

      b.将Port值设置为a5b8(十六进制),即十进制42424(默认值)

  3. 分别在网站项目A和网站项目B的Global.asax.cs中加入下面代码
    public override void Init()
    {
    base.Init();
    foreach (string moduleName in this.Modules)
    {
    string appName = "APPNAME";
    IHttpModule module = this.Modules[moduleName];
    SessionStateModule ssm = module as SessionStateModule;
    if (ssm != null)
    {
    FieldInfo storeInfo = typeof(SessionStateModule).GetField("_store", BindingFlags.Instance | BindingFlags.NonPublic);
    SessionStateStoreProviderBase store = (SessionStateStoreProviderBase)storeInfo.GetValue(ssm);
    if (store == null)//In IIS7 Integrated mode, module.Init() is called later
    {
    FieldInfo runtimeInfo = typeof(HttpRuntime).GetField("_theRuntime", BindingFlags.Static | BindingFlags.NonPublic);
    HttpRuntime theRuntime = (HttpRuntime)runtimeInfo.GetValue(null);
    FieldInfo appNameInfo = typeof(HttpRuntime).GetField("_appDomainAppId", BindingFlags.Instance | BindingFlags.NonPublic);
    appNameInfo.SetValue(theRuntime, appName);
    }
    else
    {
    Type storeType = store.GetType();
    if (storeType.Name.Equals("OutOfProcSessionStateStore"))
    {
    FieldInfo uribaseInfo = storeType.GetField("s_uribase", BindingFlags.Static | BindingFlags.NonPublic);
    uribaseInfo.SetValue(storeType, appName);
    }
    }
    }
    }
    }

      ASP.NET_SessionId Cookie的域名要设置相同的域名

asp.net 多站点共享StateServer Session的更多相关文章

  1. asp.net 多站点共享FormAuthentication

    <authentication mode="Forms"> <forms  domain="lizhanglong.com" timeout= ...

  2. nginx+iis+redis+Task.MainForm构建分布式架构 之 (redis存储分布式共享的session及共享session运作流程)

    本次要分享的是利用windows+nginx+iis+redis+Task.MainForm组建分布式架构,上一篇分享文章制作是在windows上使用的nginx,一般正式发布的时候是在linux来配 ...

  3. .net多站点通过StateServer实现session共享

    先在所有要共享站点web.config的<system.web>结点下加 <!--session的mode=StateServer--><sessionState coo ...

  4. ASP.NET二级域名站点共享Session状态

    我的前面一篇文章提到了如何在使用了ASP.NET form authentication的二级站点之间共享登陆状态, http://www.cnblogs.com/jzywh/archive/2007 ...

  5. 数据库实现多站点共享Session

    数据库实现多站点共享Session 多站点共享Session有很多方法,多站点共享Session常见的做法有: 使用.net自动的状态服务(Asp.net State Service); 使用.net ...

  6. nginx 负载均衡、用数据库存储Session,来实现多站点共享Session[转]

    多站点共享Session常见的作法有: 1.使用.net自动的状态服务(Asp.net State Service); 2.使用.net的Session数据库: 3.使用Memcached. 4.使用 ...

  7. .net学习笔记----二级域名站点共享Session状态

    前面一篇文章提到了如何在使用了ASP.NET form authentication的二级站点之间共享登陆状态, http://www.cnblogs.com/jzywh/archive/2007/0 ...

  8. Nginx + IIS实现负载均衡 Session多站点共享

    日子过得太索然无味了,研究了一下,所谓的负载均衡(主要是windows服务器IIS下的).先看看分析图:环境:linux服务器: centos 6.3windows服务器: windows serve ...

  9. nginx Win下实现简单的负载均衡(2)站点共享Session

    快速目录: 一.nginx Win下实现简单的负载均衡(1)nginx搭建部署 二.nginx Win下实现简单的负载均衡(2)站点共享Session 三.nginx Win下实现简单的负载均衡(3) ...

随机推荐

  1. Manacher 算法

    Manacher算法用于求回文子串,它的复杂度为O(n). 这个算法有一个很巧妙的地方,它把奇数的回文串和偶数的回文串统一起来考虑了.在相邻的两个字符之间加进一个分隔符 '#' ,串的首尾也要加. 原 ...

  2. Java学习之javassist

    1.读取和输出字节码 ClassPool pool = ClassPool.getDefault(); //会从classpath中查询该类 CtClass cc = pool.get("t ...

  3. eclipse 快捷键汇总

    1几个最重要的快捷键 代码助手:Ctrl+Space(简体中文操作系统是Alt+/)快速修正:Ctrl+1单词补全:Alt+/打开外部Java文档:Shift+F2 显示搜索对话框:Ctrl+H快速O ...

  4. windows如何安装和配置mongodb

    https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-windows/

  5. 收藏的技术文章链接(ubuntu,python,android等)

    我的收藏 他山之石,可以攻玉 转载请注明出处:https://ahangchen.gitbooks.io/windy-afternoon/content/ 开发过程中收藏在Chrome书签栏里的技术文 ...

  6. android select选择器 checkbox改外观,button按下状态

    android 可以用选择器.来加载视图.选择器里的选项也很多针对实际使用中用的几个进行描述. 1.button 的按下弹起改外观.选择器属性用 android:state_pressed   2.C ...

  7. [问题解决] "Nautilus could not create the required folder "/home/kenneth/.config/nautilus"

    错误: "Nautilus could not create the required folder "/home/kenneth/.config/nautilus" 发 ...

  8. Enabling Process Accounting on Linux HOWTO

    http://tldp.org/HOWTO/Process-Accounting/index.html

  9. java.util.zip.GZIPInputStream.readUByte,Not in GZIP format错误处理

    问题一: 使用webclient抓取网页时报错:(GZIPInputStream.java:207) atjava.util.zip.GZIPInputStream.readUShort(GZIPIn ...

  10. [Leetcode][Python]34: Search for a Range

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 34: Search for a Rangehttps://oj.leetco ...