1

We're having a problem where the application pools restarts (and loses all sessions) when deleting a folder in a virtual directory. This is not ImageResizers fault, but ASP.NET. We cannot replicate the issue on a static web site.

I'm wondering if someone has resolved this issue? We're thinking about creating a separate web page just for ImageResizer and image content. Maybe there is a simpler way?

This solution did not work for us: http://www.aaronblake.co.uk/blog/2009/09/28/bug-fix-application-restarts-on-directory-delete-in-asp-net/

Tony Gustafsson
  • 828
  • 1
  • 7
  • 18

2 Answers2

0

IIS and ASP.NET - both - have independent FileSystemWatchers. If you disable these, the problem should go away.

See http://imageresizing.net/docs/howto/avoid-network-limit for more information.

While the article above mentions the problem from the perspective of a latent network-based storage, the problem can appear in other ways - such as upon directory deletion.

I also suggest avoiding deleting folders on ASP.NET websites; it's a painful goal, and likely to fail due to read locks. Goodnes, folder deletion rarely works on windows — even when it's not part of a web site being actively served to clients.

Lilith River
  • 16,204
  • 2
  • 44
  • 76
  • Thanks for info! Yes, in this case it's seems to be just the ASP.NET file watcher that is the problem. I tried to change FCNMode in the registry as the link said. When I set it to 1 I got an error: [NullReferenceException: Object reference not set to an instance of an object.] System.Object.GetType() +0 XXXX.Application_Start(Object sender, EventArgs e) +289 When i set it to 2 there is no change (It just a single process instead of multiple if I understood it correctly). I also tried adding in web.config (new since .NET 4.5), but with the same result. – Tony Gustafsson Mar 06 '15 at 10:35
  • Maybe you are right... it just doesn't seem possible to remove directories in IIS. We will probably just stop deleting them, and have a removal job that we execute manually when the servers are out of the cluster. – Tony Gustafsson Mar 06 '15 at 10:39
  • I just tried the linkd/junction method described here and there on the web, but it does not work for deleted folders. I tried both linkd.exe and junction.exe (even if they seem to do the same thing) – Tony Gustafsson Mar 06 '15 at 12:25
  • Could you open another question about the NullReferenceException? That's something I haven't seen before. – Lilith River Mar 06 '15 at 21:45
  • Sure! Here it is: http://stackoverflow.com/questions/28912932/web-cannot-start-with-fcnmode-set-to-disabled – Tony Gustafsson Mar 07 '15 at 08:30
  • OK, now I've tried fcnMode disabled, and it did not solve our problem. Not removing the folders seems to have worked though :P I'm not completely satisfied with this solutions though - now we have to clean the directory with a powershell script and be sure that the server that is been cleaned is out of the cluster. – Tony Gustafsson Mar 11 '15 at 07:43
  • I can now confirm that the site stopped restarting when we stopped to delete folders. I guess we have to get used to some empty folders and delete them with powershell when they are out of the cluster. – Tony Gustafsson Mar 19 '15 at 13:46
0

It seems to be possible to use IIS application instead of Virtual directory, and use a different application pool for the image archive. I tried, and the problem was solved... this appool restarted instead, which didn't affect the web pool. Great success!

However, I don't think we will be doing this either. It seems as a IIS application needs it's own bin folder. I had to copy the image resizer DLLs here. I also had to write another global.asax for auto 404 images in Application_Start. It works... I just don't want the image directory to have a lot of code in it. It is synced from a third party.

Tony Gustafsson
  • 828
  • 1
  • 7
  • 18