PRB: Random application restarts with "Application is restarting" error in ASP.NET (312592)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ASP.NET (included with the .NET Framework) 1.0

This article was previously published under Q312592

SYMPTOMS

When you run ASP.NET on a computer that is using antivirus software with real-time monitoring enabled, you may notice that a random application restarts, and you receive the following error message in the browser:
Application is restarting.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Application is restarting.

CAUSE

This problem occurs because of some antivirus applications write back information to the files that they scan. Every time a user changes the Web.config configuration file, the Global.asax file, or the contents of the Bin folder, the application should restart to incorporate these changes. Because antivirus scanning changes cannot be distinguished from the user's file changes, the application restarts when the antivirus software scans these folders.

Note This problem may occur even when no error is returned. If the virus-scanning software triggers change notifications, every change notification is doubled at the very least: one real change notification and an additional change notification from the antivirus software some time later.

RESOLUTION

Use one of the following methods to resolve this problem:
  • Disable real-time monitoring in your antivirus software.
  • Exclude the application folders from the antivirus scan list.
Please consult your antivirus software documentation for instructions about how to change these settings.

With some antivirus software, you may be able to increase the delayNotificationTimeout attribute of the <httpRuntime> configuration section in the Web.config file to work around this problem. This value is set with the following entry in the Web.config file:
<httpRuntime delayNotificationTimeout="5" />
				
The default value is 5 seconds, which is sometimes not enough for specific hardware. To resolve the problem on your computer, you must increase the time-out value to a value that works for your hardware and computer speed (for example 60).

STATUS

This behavior is by design.

MORE INFORMATION

If the file update occurs while the first request is being processed, ASP.NET rejects the request and displays the "Application is restarting" error because the notification occurs before the application is fully compiled.

REFERENCES

For additional information about related issues with Microsoft Mobile Internet Toolkit, click the following article number to view the article in the Microsoft Knowledge Base:

310619 PRB: Session state is lost in Mobile Web Form applications during development


Modification Type:MajorLast Reviewed:5/17/2004
Keywords:kbHttpRuntime kbprb KB312592