473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

workaround for FCN/directory delete bug

hi,

I have come across the problem mentioned in this blog

http://blogs.msdn.com/toddca/archive...01/499144.aspx

it's basically the fact that in ASP.NET 2.0, the File Change Notification is
uses causes the application to unload every time a directory underneath the
webroot is deleted.

The bodge suggested as a work-around in the article (which involves messing
around with the file system) is not an option that is open to me.

Does anyone know whether a proper fix or workaround for this problem is
available? if not, the only thing I can think of is to delete only files at
runtime and then wait until application shutdown to clear the directory
tree.

Regards,

Andy
Aug 30 '07 #1
5 2141
create an app_data folder in your site, which asp.net does not monitor.

-- bruce (sqlwork.com)
Andy Fish wrote:
hi,

I have come across the problem mentioned in this blog

http://blogs.msdn.com/toddca/archive...01/499144.aspx

it's basically the fact that in ASP.NET 2.0, the File Change Notification is
uses causes the application to unload every time a directory underneath the
webroot is deleted.

The bodge suggested as a work-around in the article (which involves messing
around with the file system) is not an option that is open to me.

Does anyone know whether a proper fix or workaround for this problem is
available? if not, the only thing I can think of is to delete only files at
runtime and then wait until application shutdown to clear the directory
tree.

Regards,

Andy

Aug 30 '07 #2
Thanks Bruce,

From what I can see, files in the app_data folder are not served through
IIS. Files in the folder structure I am creating need to be visible to the
web browser, so that solution is no good for me.

Andy

"bruce barker" <no****@nospam.comwrote in message
news:uJ**************@TK2MSFTNGP06.phx.gbl...
create an app_data folder in your site, which asp.net does not monitor.

-- bruce (sqlwork.com)
Andy Fish wrote:
>hi,

I have come across the problem mentioned in this blog

http://blogs.msdn.com/toddca/archive...01/499144.aspx

it's basically the fact that in ASP.NET 2.0, the File Change Notification
is uses causes the application to unload every time a directory
underneath the webroot is deleted.

The bodge suggested as a work-around in the article (which involves
messing around with the file system) is not an option that is open to me.

Does anyone know whether a proper fix or workaround for this problem is
available? if not, the only thing I can think of is to delete only files
at runtime and then wait until application shutdown to clear the
directory tree.

Regards,

Andy
Aug 31 '07 #3
just found this:

https://connect.microsoft.com/Visual...dbackID=240686

and I have implemented Kritter's hack which works fine for me on XP and win
2003 - copied below FYI:

Entered by [By]Kritter on 23/07/2007

A dirty hack that works:
PropertyInfo p =
typeof(System.Web.HttpRuntime).GetProperty("FileCh angesMonitor",
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[] { });

This code will turn off monitoring from the root website directory, but
monitoring of Bin, App_Themes and other folders will still be operational,
so updated DLLs will still auto deploy.


"Andy Fish" <aj****@blueyonder.co.ukwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Thanks Bruce,

From what I can see, files in the app_data folder are not served through
IIS. Files in the folder structure I am creating need to be visible to the
web browser, so that solution is no good for me.

Andy

"bruce barker" <no****@nospam.comwrote in message
news:uJ**************@TK2MSFTNGP06.phx.gbl...
>create an app_data folder in your site, which asp.net does not monitor.

-- bruce (sqlwork.com)
Andy Fish wrote:
>>hi,

I have come across the problem mentioned in this blog

http://blogs.msdn.com/toddca/archive...01/499144.aspx

it's basically the fact that in ASP.NET 2.0, the File Change
Notification is uses causes the application to unload every time a
directory underneath the webroot is deleted.

The bodge suggested as a work-around in the article (which involves
messing around with the file system) is not an option that is open to
me.

Does anyone know whether a proper fix or workaround for this problem is
available? if not, the only thing I can think of is to delete only files
at runtime and then wait until application shutdown to clear the
directory tree.

Regards,

Andy

Sep 10 '07 #4
My personal preference is just to not store those files under my web site
structure :
- you can server files stored outside of your structure (using an ASPX page
or a handler that allows additionaly to control how it is accessed
especially if those files are not supposed to be served to everyone)
- you could also likely use a virtual folder

This keep your web application and its data apart...

--
Patrice

"Andy Fish" <aj****@blueyonder.co.uka écrit dans le message de news:
eU*************@TK2MSFTNGP06.phx.gbl...
just found this:

https://connect.microsoft.com/Visual...dbackID=240686

and I have implemented Kritter's hack which works fine for me on XP and
win 2003 - copied below FYI:

Entered by [By]Kritter on 23/07/2007

A dirty hack that works:
PropertyInfo p =
typeof(System.Web.HttpRuntime).GetProperty("FileCh angesMonitor",
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[] { });

This code will turn off monitoring from the root website directory, but
monitoring of Bin, App_Themes and other folders will still be operational,
so updated DLLs will still auto deploy.


"Andy Fish" <aj****@blueyonder.co.ukwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Thanks Bruce,

From what I can see, files in the app_data folder are not served through
IIS. Files in the folder structure I am creating need to be visible to
the web browser, so that solution is no good for me.

Andy

"bruce barker" <no****@nospam.comwrote in message
news:uJ**************@TK2MSFTNGP06.phx.gbl...
>>create an app_data folder in your site, which asp.net does not monitor.

-- bruce (sqlwork.com)
Andy Fish wrote:
hi,

I have come across the problem mentioned in this blog

http://blogs.msdn.com/toddca/archive...01/499144.aspx

it's basically the fact that in ASP.NET 2.0, the File Change
Notification is uses causes the application to unload every time a
directory underneath the webroot is deleted.

The bodge suggested as a work-around in the article (which involves
messing around with the file system) is not an option that is open to
me.

Does anyone know whether a proper fix or workaround for this problem is
available? if not, the only thing I can think of is to delete only
files at runtime and then wait until application shutdown to clear the
directory tree.

Regards,

Andy


Sep 10 '07 #5
for the most part that is exactly what I am doing

however, to serve optimized (linearized) pdfs properly is rather more
complicated because the browser requests chunks of the file with separate
HTTP requests, so for this case I decided the best solution was to make a
temporary copy of the PDF underneath the web root, then redirect the browser
to it. that way the optimized download works properly without lots of extra
code

Andy

"Patrice" <http://www.chez.com/scribe/wrote in message
news:eT****************@TK2MSFTNGP05.phx.gbl...
My personal preference is just to not store those files under my web site
structure :
- you can server files stored outside of your structure (using an ASPX
page or a handler that allows additionaly to control how it is accessed
especially if those files are not supposed to be served to everyone)
- you could also likely use a virtual folder

This keep your web application and its data apart...

--
Patrice

"Andy Fish" <aj****@blueyonder.co.uka écrit dans le message de news:
eU*************@TK2MSFTNGP06.phx.gbl...
>just found this:

https://connect.microsoft.com/Visual...dbackID=240686

and I have implemented Kritter's hack which works fine for me on XP and
win 2003 - copied below FYI:

Entered by [By]Kritter on 23/07/2007

A dirty hack that works:
PropertyInfo p =
typeof(System.Web.HttpRuntime).GetProperty("FileC hangesMonitor",
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[] { });

This code will turn off monitoring from the root website directory, but
monitoring of Bin, App_Themes and other folders will still be
operational, so updated DLLs will still auto deploy.


"Andy Fish" <aj****@blueyonder.co.ukwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>Thanks Bruce,

From what I can see, files in the app_data folder are not served through
IIS. Files in the folder structure I am creating need to be visible to
the web browser, so that solution is no good for me.

Andy

"bruce barker" <no****@nospam.comwrote in message
news:uJ**************@TK2MSFTNGP06.phx.gbl...
create an app_data folder in your site, which asp.net does not monitor.

-- bruce (sqlwork.com)
Andy Fish wrote:
hi,
>
I have come across the problem mentioned in this blog
>
http://blogs.msdn.com/toddca/archive...01/499144.aspx
>
it's basically the fact that in ASP.NET 2.0, the File Change
Notification is uses causes the application to unload every time a
directory underneath the webroot is deleted.
>
The bodge suggested as a work-around in the article (which involves
messing around with the file system) is not an option that is open to
me.
>
Does anyone know whether a proper fix or workaround for this problem
is available? if not, the only thing I can think of is to delete only
files at runtime and then wait until application shutdown to clear the
directory tree.
>
Regards,
>
Andy
>



Sep 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Russell E. Owen | last post by:
I stumbled across a really strange bug involving directories on linux. os.path.exists(path) can return 0 even after os.path.mkdir(path) succeeds (well after; this isn't a timing issue). For...
0
by: Steve Walker | last post by:
A framework issue rather than a pure C# issue, so a little off topic, but the aspnet.webcontrols group is very quiet, and people here seem more experienced: I came across an irritating problem...
3
by: Karel | last post by:
Hello, I have a VB.NET application where I want to move directories over a network. I tried this with system.io.directory.move, but that doesn't work over different volumes. Has anyone a...
3
by: James | last post by:
..2003 have a filesystemwatcher ... does it have a directorysystemwatcher ? What i need is to watch whether directory is deleted ? i assume filesystemwatcher delete method is for file, not...
23
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
7
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) ...
1
by: jlskutt | last post by:
I'm getting an odd Exception thrown using Directory.Delete. Directory.Delete(publicData + "Chatrooms/K" + kingd, true); Directory.Delete(publicData + "Kingdoms/" + kingd, true); There are...
3
by: Koliber (js) | last post by:
sorry for my bad english when I fire up (from my c# code) a standard "file - save as " dialog, and when chosen location is a shered local network directory, where I do have rights to create...
3
by: Steph | last post by:
hello, i ve a probleme when deleting a directory and when i want create file immediatly after. 1) Directory.Delete(myPath, true); 2) TextWriter sw = new StreamWriter(myPath +"test.aspx"); i...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.