富贵资源网 Design By www.hznty.com
仔细一看,SSO返回的ticket也不相同,才发现原来IIS重启了,最后解决方案如下:
新建一个类继承IHttpModule
复制代码 代码如下:
/// <summary>
/// Stops the ASP.NET AppDomain being restarted (which clears
/// Session state, Cache etc.) whenever a folder is deleted.
/// </summary>
public class StopAppDomainRestartOnFolderDeleteModule : IHttpModule
{
private static bool DisableFCNs = false;
public void Init(HttpApplication context)
{
if (DisableFCNs) return;
PropertyInfo p = typeof(HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
object o = p.GetValue(null, null);
FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });
DisableFCNs = true;
}
public void Dispose() { }
}
随后在Web.Config中加入Module配置
复制代码 代码如下:
<!--解决删除项目文件/文件夹引起的IIS重启-->
<add name="stopAppDomainRestartOnFolderDelete" type="DeployAssistant.Facade.Web.StopAppDomainRestartOnFolderDeleteModule,DeployAssistant.Facade"/>
这样每次再删除文件/文件夹AppDomain都不会重启了,Session也不会丢失了。世界也变得更美好了!
PS:Web.Config和bin文件夹下的改动依然会让Web重启,这也是必须保留的!
新建一个类继承IHttpModule
复制代码 代码如下:
/// <summary>
/// Stops the ASP.NET AppDomain being restarted (which clears
/// Session state, Cache etc.) whenever a folder is deleted.
/// </summary>
public class StopAppDomainRestartOnFolderDeleteModule : IHttpModule
{
private static bool DisableFCNs = false;
public void Init(HttpApplication context)
{
if (DisableFCNs) return;
PropertyInfo p = typeof(HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
object o = p.GetValue(null, null);
FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });
DisableFCNs = true;
}
public void Dispose() { }
}
随后在Web.Config中加入Module配置
复制代码 代码如下:
<!--解决删除项目文件/文件夹引起的IIS重启-->
<add name="stopAppDomainRestartOnFolderDelete" type="DeployAssistant.Facade.Web.StopAppDomainRestartOnFolderDeleteModule,DeployAssistant.Facade"/>
这样每次再删除文件/文件夹AppDomain都不会重启了,Session也不会丢失了。世界也变得更美好了!
PS:Web.Config和bin文件夹下的改动依然会让Web重启,这也是必须保留的!
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...