zoukankan      html  css  js  c++  java
  • IIS应用程序池自动回收作业

    vb:

    appPoolName = WScript.Arguments(0)
    
    Set oWebAdmin = GetObject("winmgmts:rootWebAdministration")
    
    Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='" + appPoolName + "'")
    
    oAppPool.Recycle
    
    set fso=createobject("scripting.filesystemobject")
    
    if (fso.fileexists("C:WebRootWebSiteFLFTaskLogs
    ecycleIISPool.log")) then
    
       '1-forreading,2-forwriting,8-appending
    
       set file=fso.opentextfile("C:WebRootWebSiteFLFTaskLogs
    ecycleIISPool.log",8,ture)
    
    else
    
       set file=fso.createtextfile( "C:WebRootWebSiteFLFTaskLogs
    ecycleIISPool.log",8,ture)
    
    end if
    
    'write(x)写入x个字符,writeline写入换行,writeblanklines(n)写入N个空行
    
    file.writeline  now&" 应用程序池“"&appPoolName &"”已经回收成功。"
    
    file.close

    并写bat

    cscript recyclepool.vbs EduWebApi

    并放入任务计划程序中 执行Bat

     追加:

    回收之后,但还是解决不了,回收第一次的请求卡,再追加一个Bat,调起url请求访问,借用curl实现:

    @echo off
    color 1f
    echo 正在调起程序
    
    echo.>>check.txt
    echo.正在调起程序 %date% >>check.txt
    
    echo 开始执行baidu.com   %date% %time% >>check.txt
    curl -s http://www.baidu.com/api/Common/CheckProveStatus>>check.txt
    echo. 执行完成  %time% >>check.txt
  • 相关阅读:
    索引
    convert 时间转换
    SQL中的case when then else end用法
    SVN安装图解
    dos 命令
    阿里云服务器相关知识
    mvc知识应用
    MVC分页
    mvc系统过滤器
    .net 接口
  • 原文地址:https://www.cnblogs.com/shikyoh/p/8146401.html
Copyright © 2011-2022 走看看