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. php获取post参数的几种方式

    php获取post参数的几种方式 1.$_POST['paramName'] 只能接收Content-Type: application/x-www-form-urlencoded提交的数据 2.fi ...

  2. 简单的BFS学习笔记

    什么是BFS传送门. 今天学习BFS,加油! 先定义个数组: struct Node{ int a=0; int b=0; int step=0; }; int map[5][4]={//地图 0,0 ...

  3. Java并发编程实践(读书笔记) 任务执行(未完)

    任务的定义 大多数并发程序都是围绕任务进行管理的.任务就是抽象和离散的工作单元.   任务的执行策略 1.顺序的执行任务 这种策略的特点是一般只有按顺序处理到来的任务.一次只能处理一个任务,后来其它任 ...

  4. poco vs Boost[ZZ]

    http://wooce.iteye.com/blog/634395 POCO的优点: 1) 比boost更好的线程库,特别是一个活动的方法的实现,并且还可设置线程的优先级. 2) 比 boost:a ...

  5. avalon.js实践 svg地图配置工具

    MVVM模式,在很多复杂交互逻辑下面,有很大的优势.现在相关的框架也很多,现在项目中使用了avalon.js,选择它的原因,是兼容性的考虑,当然也要支持下国内开发大牛,至于性能方面的,没有实际测试过, ...

  6. 3D空间坐标系转换复习

    模型坐标系:ModelSpace     即模型本身为中心  模型本身自己 世界坐标系:WorldSpace    世界坐标系   整个世界 视角坐标系: ViewSpace       眼睛看到的范 ...

  7. 程序员眼里IE浏览器是什么样的

    主流浏览器之争从上个世纪开就开始,已经持续了很长的时间.就在几年前,IE还是最主流的web浏览器.但现在形势完全不同了,人们都在笑话IE,纷纷转向其它浏览器.今天,我向大家分享一下针对IE的搞笑图片, ...

  8. Repeat Number

    Problem B: Repeat Number Time Limit: 1 Sec  Memory Limit: 32 MB Description Definition: a+b = c, if ...

  9. MapReduce ---- TD-IDF

    1.TF-IDF TF-IDF(term frequency/inverse document frequency) 的概念被公认为信息检索中最重要的发明.描述单个term与特定document的相关 ...

  10. KPI考核

    编辑 本词条缺少名片图,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! KPI考核,Key Performance Indicator的缩写,指的是关键绩效指标考核法. 中文名 KPI考核 外 ...