ASP.NET MVC app restarts itself
Asked Answered
W

2

5

We are encountering an issue where our ASP.NET MVC app is restarting for an unknown reason. The cause of the shut down is

"A subdirectory in the Bin application directory was changed or renamed."

The file in question turned out to be C:\Users\Jason\AppData\Local\Temp\Temporary ASP.NET Files\root\f691a68c\a1593a1e\hash\hash.web.

Something noteworthy is that we are starting up a NServiceBus client in Application_Start and if we comment out that line, our web app doesn't restart itself. The the questions are: 1) What does hash.web do and 2) Is this issue NServiceBus related?

Wanhsien answered 6/1, 2010 at 1:47 Comment(0)
H
4

are you using log4net in your application at all? in some of our environments we had log4net logging files to the same directory as the app (i.e. bin directory) and it would cause the application to restart. moving the log files out of that directory resolved the issue.

Hoax answered 6/1, 2010 at 18:48 Comment(1)
log4net was the cause. Thanks.Wanhsien
D
3

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?

Dinka answered 6/1, 2010 at 2:1 Comment(4)
It's the Visual Studio web server that's hitting the file.Wanhsien
This is happening on my local development box. The Visual Web Server I'm referring to is WebDev.WebServer.EXEWanhsien
Thanks for the down vote. I didn't realize only production environment related questions are allowed (or cared about) on Stackoverflow.Wanhsien
I noticed an app I was working on this morning was invoking the DI registration process multiple times due to the Application_Start() method getting called multiple times. Combined with Scott Guthrie's post on logging what happens during the Application_End(), using Process Monitor was key to discovering that it was indeed the virus scanner touching a file which was leading to the reset. Thanks for your answer!Chaparral

© 2022 - 2024 — McMap. All rights reserved.