PDA

View Full Version : اشكالي در استفاده از دستور Directory.Delete



mk88km
چهارشنبه 25 اردیبهشت 1387, 14:02 عصر
سلام به همه
تا حالا كسي از دستور Dirctory.Delete استفاده كرده؟
من اين كار رو كردم اما انگار اشكالي پيش مياد به نظر مي رسه اين دستور همه Session ها رو Null مي كنه .
كسي چيزي در اين مورد ميدونه؟

shahab_ksh
چهارشنبه 25 اردیبهشت 1387, 15:34 عصر
من اين كار رو كردم اما انگار اشكالي پيش مياد به نظر مي رسه اين دستور همه Session ها رو Null مي كنه .
كسي چيزي در اين مورد ميدونه؟


ممکنه شما این دستور رو در مورد بعضی فایلهای حیاتی برنامه بکار میبرید مثلا در دایرکتوری bin یا دایرکتوری مربوط به زبان یا مسترپیج این باعت رست شدن برنامه شما میشه

mk88km
شنبه 28 اردیبهشت 1387, 14:53 عصر
نه من دايركتوري هايي كه خودم به صورت موقت ايجادكردم پاك مي كنم.

amirferdowsi
شنبه 28 اردیبهشت 1387, 19:45 عصر
تا حالا كسي از دستور Dirctory.Delete استفاده كرده؟
من اين كار رو كردم اما انگار اشكالي پيش مياد به نظر مي رسه اين دستور همه Session ها رو Null مي كنه .
كسي چيزي در اين مورد ميدونه؟

سلام
من هم همین مشکل رو دارم
لطفاً راهنمایی بفرمائید

miladr
یک شنبه 29 اردیبهشت 1387, 18:01 عصر
این در واقع یک مشکل نیست بلکه یک امکان جدید هست که اگر شما از session و به صورت معمولی استفاده کنید با حذف یک پوشه AppDomain ریاستارت میشه.برای حل این مشکل شما باید شیوه ذخیره session رو تغییر بدین برای اطلاعات بیشتر این مقاله رو بخونین.
http://www.srco.ir/Articles/DocView.asp?ID=440

mk88km
دوشنبه 30 اردیبهشت 1387, 15:28 عصر
ممنون از راهنمايي تون. من تو فايل وب كانفيگ sessionstate تعريف كردم با مد ServerState اما اين پيغام رو ميده

Server Error in '/www' Application.

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

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.Web.HttpException: Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[SerializationException: Type 'PegaheAftab.Common.UserData' in Assembly 'PegahCommonLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.] System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType type) +2317861 System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type type, StreamingContext context) +245 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo() +88 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +305 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +50 System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +438 System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131 System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph) +12 System.Web.Util.AltSerialization.WriteValueToStrea m(Object value, BinaryWriter writer) +2020[HttpException (0x80004005): Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.] System.Web.Util.AltSerialization.WriteValueToStrea m(Object value, BinaryWriter writer) +2124 System.Web.SessionState.SessionStateItemCollection .WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +54 System.Web.SessionState.SessionStateItemCollection .Serialize(BinaryWriter writer) +852 System.Web.SessionState.SessionStateUtility.Serial ize(SessionStateStoreData item, Stream stream) +255 System.Web.SessionState.SessionStateUtility.Serial izeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length) +85 System.Web.SessionState.OutOfProcSessionStateStore .SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +107 System.Web.SessionState.SessionStateModule.OnRelea seState(Object source, EventArgs eventArgs) +713 System.Web.SyncEventExecutionStep.System.Web.HttpA pplication.IExecutionStep.Execute() +167 System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +117

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

mk88km
سه شنبه 31 اردیبهشت 1387, 09:42 صبح
ياري اندر كس نمي بينم، ياران را چه شد؟

cemohsen
چهارشنبه 25 دی 1387, 00:33 صبح
من هم همین مشکل رو داشتم و اومدم اینجا که مثلا جواب رو پیدا کنم ، اما خبری نبود
بعد از کلی راه کارهای مختلف رو امتحان کردن و کلی روش رو تست کردن و ... در آخر از کد زیر استفاده کردم
اولا این مشکل نیست و توی .net 2 با اسم File Change Notifications)FCN) اومده
و اما برای اینکه این مشکل بوجود نیاد می تونیم کد زیر رو به global.asax تو متد Application_Start بنویسم


System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
object o = p.GetValue(null, null);
System.Reflection.FieldInfo f = o.GetType().GetField("_dirMonSubdirs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
System.Reflection.MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });
البته با این کد هنوز عمل مونیتورینگ روی پوشه های خود پروژه مثل BIN و THEME انجام می شه ، اما به بقیه پوشه ها کاری نداره