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

      

  • 相关阅读:
    洛谷——P1951 收费站_NOI导刊2009提高(2)
    洛谷——P1475 控制公司 Controlling Companies
    洛谷——P1176 路径计数2
    洛谷——P1156 垃圾陷阱
    洛谷——P2734 游戏 A Game
    洛谷——P1767 家族_NOI导刊2010普及(10)
    洛谷——P1413 坚果保龄球
    Kali-linux破解LM Hashes密码
    Kali-linux分析密码
    Kali-linux密码在线破解
  • 原文地址:https://www.cnblogs.com/jiebian/p/2628132.html
Copyright © 2011-2022 走看看