Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


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).

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


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.

↑ Back to the top


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

↑ Back to the top


Article Info
Article ID : 312592
Revision : 7
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 639