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();//得到回写的字节流
                
            }
        }
    }
    

      

  • 相关阅读:
    linux ssh 免密码登录
    Emacs Org Mode学习
    Emacs Org Mode学习
    java--for循环,一个分号的区别
    java--for循环,一个分号的区别
    【JVM.6】虚拟机类加载机制
    【JVM.5】类文件结构
    【JVM.4】调优案例分析与实战
    【JVM.3】虚拟机性能监控与故障处理工具
    【JVM.2】垃圾收集器与内存分配策略
  • 原文地址:https://www.cnblogs.com/jiebian/p/2628132.html
Copyright © 2011-2022 走看看