zoukankan      html  css  js  c++  java
  • global

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.SessionState;
    using System.Net;
    using System.IO;
    using System.Threading;
    using Logger;
    using System.Timers;
    using Untitly;
    using System.Runtime.Remoting.Messaging;
    namespace WebApplication1
    {
        public class Global : System.Web.HttpApplication
        {
            //定义定时器 
            private myTimer m;
            protected void Application_Start(object sender, EventArgs e)
            {
                new Thread((ThreadStart)delegate()
                {
                  m=  Singleton<myTimer>.getInstance();
                  m.time();
                })
                .Start();
            }
            
            
            protected void Session_Start(object sender, EventArgs e)
            {
    
            }
    
            protected void Application_BeginRequest(object sender, EventArgs e)
            {
            }
    
            protected void Application_AuthenticateRequest(object sender, EventArgs e)
            {
    
            }
    
            protected void Application_Error(object sender, EventArgs e)
            {
                Exception ex = Server.GetLastError().GetBaseException();
                Log.WriteErrorLog(ex);
            }
    
            protected void Session_End(object sender, EventArgs e)
            {
    
            }
    
            protected void Application_End(object sender, EventArgs e)
            {
                //下面的代码是关键,可解决IIS应用程序池自动回收的问题
                Thread.Sleep(1000);
                //这里设置你的web地址,可以随便指向你的任意一个aspx页面甚至不存在的页面,目的是要激发Application_Start            
                string url = "/default.aspx";
                HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                Stream receiveStream = myHttpWebResponse.GetResponseStream();//得到回写的字节流
                
            }
        }
    }
    

      

  • 相关阅读:
    我是怎么找到电子书的

    task1
    centos7 部署 nginx+tomcat+MariaDB 环境并安装安全狗,使用natapp隧道
    CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
    mysql 配置 root 远程访问
    tomcat 配置 https 证书
    how2j 的shiro教程初探
    springboot 设置 session 过期时间
    mybatis 异常 too many connections 解决方案 mysql
  • 原文地址:https://www.cnblogs.com/jiebian/p/2628132.html
Copyright © 2011-2022 走看看