• IIS app pool recycling randomly every few seconds


    IIS app pool recycling randomly every few seconds

    You don't have to incur overhead to add custom logging, ASP.NET 2.0 health monitoring does the job for you. You can add the following configuration which will log events in the eventlogs with information why Application pool is restarted.

    To turn ASP.NET health monitoring ON, you can edit the "master" web.config file, normally found in %systemroot%\microsoft.net\framework\v2.0.50727\config.

    • First, look for <healthMonitoring> in the master web.config

    • Inside the healthMonitoring node, find the <rules> node

    • Inside rules, add the following:

      <add name="Application Lifetime Events Default"       
           eventName="Application Lifetime Events"       
           provider="EventLogProvider"       
           profile="Default"       
           minInstances="1"       
           maxLimit="Infinite"       
           minInterval="00:01:00"       
           custom="" /> 
      

    Reproduce the issue and look in the Application event log fpr a source of ASP.NET 2.0. This should log why application pool is recycled.

    逐条查看event log里面的信息,注意event code的不同,比如1002和1003

    发现这个提示信息,

    Event code: 1002 
    Event message: Application is shutting down. Reason: A subdirectory in the Bin application directory was changed or renamed. 
    Event time: 29/03/2022 13:13:14 
    Event time (UTC): 29/03/2022 12:13:14 
    Event ID: f122178201b44afebff56d69425e4cba 
    Event sequence: 1 
    Event occurrence: 1 
    Event detail code: 50007 

    Change Notification for critical directories

    Symptoms

    When the end users execute any action in their Work Portal, the application redirects them to the Start page.
    The Administrator user identifies that the Application is constantly restarted and the Application Server Log Viewer records the following error:

    Cause

    The Framework finds changes in the bin directory and restarts the application.

    Solution

    First, validate that your server does not have viruses or another agent that can possibly change the bin directory. Review your Antivirus configuration and perform a general check on the server.

    If the server is virus-free and there is no external agent making changes in the bin directory, perform a change in the Windows Registry of your server. To do this, follow the instructions below:

    1. Take a backup of the Windows Registry:

    1.1. Click the Start button, click Run, and type REGEDIT. Click OK.
    1.2. In the Registry Editor, select the HKLM\Software\Microsoft\ASP.NET\ branch.
    1.3. From the Registry menu, choose Export Registry File.
    1.4. In the Save In list, select the folder where you want to save the backup.
    1.5. In the File Name box, type a name for your backup file, such as "Options" or "Backup."
    1.6. In the Export Range box, be sure that "Selected branch" is selected.
    1.7. Click Save. The file is saved with a .reg extension.

    2. Create the FCNMode key with type DWORD and value 1 in the branch HKLM\Software\Microsoft\ASP.NET\

    2.1. Select the branch HKLM\Software\Microsoft\ASP.NET\.
    2.2. Right-click on the entry and select New DWORD (32bit) value.
    2.3. Put the name FCNMODE.
    2.4. Right-click on the key FCNMODE and select Modify. 
    2.5. In the Value data box, set 1.
    2.6. Exit Registry Editor.

    https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.fcnmode?view=netframework-4.8

    Default 1

    For each subdirectory, the application creates an object that monitors the subdirectory. This is the default behavior.

    Disabled 2

    File change notification is disabled.

    NotSet 0

    File change notification is not set, so the application creates an object that monitors each subdirectory. This is the default behavior.

    Single 3

    The application creates one object to monitor the main directory and uses this object to monitor each subdirectory.

    ASP.NET MVC app restarts itself

    You need to figure out what is touching the hash.web file: a likely cause is a virus scanner. Monitor the file with Process Monitor.

    If possible, exclude the Temporary ASP.NET Files directory and subdirectories from automatic virus scanning as well as the web content directories.

    In .NET 2.0 it is possible to disable FileChangesMonitoring through the HKLM\Software\Microsoft\ASP.NET\FCNMode key, a value of 1 will disable file change monitoring. The drawback of disabling this is that if you disable it, the application will not restart if you change web.config etc.

    Of Interest: ASP.NET File Change Notifications, exactly which files and directories are monitored?

  • 相关阅读:
    【杭电】[4857]逃生
    【杭电】[2647]Reward
    【杭电】[1285]确定比赛名次
    【杭电】[1251]统计难题
    OJ系统上线——OJ.BoilTask.com
    【郑轻】[1893]985的数学难题
    【郑轻】[1900]985的“树”难题
    【郑轻】[1898]985的数字难题
    HDU 1850———nim博弈
    HDU 2188------巴什博弈
  • 原文地址:https://www.cnblogs.com/chucklu/p/16073815.html
Copyright © 2020-2023  润新知