IIS receives a reboot during a file delete / store operation on the server and loses a session

I have the option to delete files for files uploaded by the user, the user can upload multiple files at once. The downloaded files will be stored in a folder on the server, and when it is deleted, it will be moved to the garbage basket, from where it will be cleaned manually.

when a user tries to delete many files on a web page, IIS gets stuck and the whole session has expired. This case is present only on the server, in the local host this problem is not available.

ALL operations are performed in full, i.e.

  • The database is being updated.

  • Files are moved from the download folder to the trash folder on the server.

I can’t determine what is going wrong, I was just trying to delete a lot of files of only about 35-36 MB. Is there a problem with a long process or are there any changes for working with large files, my project is running on VS2005, which runs on a 2008 server, please help ...

+3
source share
3 answers

If you delete a file / folder under your website or virtual directory, your web application will be restarted, which will destroy all (in-process) sessions. The solution will be quite simple - make sure that you store files outside the directory of your website.

+3
source

: , SQL Server ASP.Net State Manager. , .

http://msdn.microsoft.com/en-us/library/ms972429.aspx (. )

+1

, , ...

http://forums.asp.net/p/1144478/1849837.aspx

PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
object o = p.GetValue(null, null);

FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);

MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });

.. , Application_Start global.asax

"using System.Reflection" Global.asax.cs

0

Source: https://habr.com/ru/post/1780400/


All Articles