开发者

IIS get restart on file delete/store operation in server and losing session

I have a file delete option for the files uploaded by the user, user can upload many files at a time.The uploaded files will be stored开发者_StackOverflow社区 in a folder in server and when its is deleted its is moved to trash folder from where it will be manually cleared.

when a user tries to delete many files in the web page IIS get hangs and all session is expired. This case only present in server,in local host this issue is not available.

ALL the operations is carried out completely ie

  • Database gets updated.

  • Files is moved from upload folder to trash folder in server.

I cannot determine what is going wrong,I just tried to delete many files totally around 35-36 MB. Is the issue with process taking long or is there any changes have to be made in order to perform large files operation, my project is done on VS2005 which is running in 2008 server please help...


If you delete file/folder under your web site or virtual directory, your web application will be re-started resulting in wiping out all (in-process) sessions. Solution would be quite simple - make sure that you store your files outside your web site directory.


Alternate solution: decouple your session state from your process by using SQL Server as a state manager or using the ASP.Net State Manager service. This will require that all of your session objects are serializable.

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


old post, but found a solution on an other forum for who still ends up here after searching...

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[] { });

..and add it to a good place, such as Application_Start in global.asax

You must add "using System.Reflection" to Global.asax.cs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜