473,795 Members | 3,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CacheDependency creation fails on the 49th instantiation using a UNC directory

I am getting the following error when creating a new CacheDependency
object:
Failed to start monitoring changes to '\\server\share \dir49'
This error happens after 48 successful instantiations of
CacheDependency using the same fileserver.

I have an ASP.NET application that needs to display filecounts for 300
different directories on my fileserver. I have a loop where I get each
directory and determine the number of files. In order to make this more
efficient, I want to use the cache object to hold the filecount and
make this dependent on the directory which holds the files. When a file
is added or dropped, the cached item is removed, and I can rebuild it
on my next attempt at reading it.

This works well for the first 48 iterations in the loop. On the 49th
iteration I get the error above. Every directory is on the same drive
and they have identical security settings. If I process the directories
in a different order, it still fails on the 49th. It does not fail if
the files are on the local filesystem.

What is causing this? If I try to instantiate the CacheDependancy
objects again (on the next page request), they will succeed (not raise
any errors) but then not work, e.g. not clear the cache when the
directory changes. The first 48 continue to work as expected.

Example code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Try
Dim strRoot As String = "\\server\share " ' must have 50+
subdirectories to test this error
Dim strPath As String
Dim intCount As Integer = 0
For Each strPath In
System.IO.Direc tory.GetDirecto ries(strRoot)
Response.Write( intCount & " :" &
GetCachedFileCo unt(strPath) & "<br>")
intCount += 1
Next
Catch ex As Exception
Response.Write( ex.Message)
End Try
End Sub

Private Function GetCachedFileCo unt(ByVal FullPath As String) As
Integer
Dim intFileCount As Integer
Dim dep As System.Web.Cach ing.CacheDepend ency
If Cache.Item(Full Path) Is Nothing AndAlso intCacheCount < 20
Then
If System.IO.Direc tory.Exists(Ful lPath) Then
intFileCount =
System.IO.Direc tory.GetFiles(F ullPath).Length
Try
Response.Write( FullPath & "<br>")
dep = New
System.Web.Cach ing.CacheDepend ency(FullPath)
Cache.Insert(Fu llPath, intFileCount, dep)
Catch ex As Exception
Response.Write( "Failed: " & ex.Message & "<br>")
End Try
Else
intFileCount = 0
End If
Else
intFileCount = Cache.Get(FullP ath)
End If
Return intFileCount
End Function

Sep 21 '05 #1
0 1097

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

Similar topics

8
3453
by: Anthony Munter | last post by:
I have a web application with impersonate=”true” in Web.config and on my own logon page I allow the user to either - specify a userid/password for the app to impersonate when calling legacy COM objects - or, just use the interactive user If they choose to use the interactive option, the impersonate="true" means that the process runs under the interactiv user (which I've confirmed works correctly). If they specify a userid/password, I...
0
961
by: Nick | last post by:
I am getting the following error when creating a new CacheDependency object: Failed to start monitoring changes to '\\server\share\dir49' This error happens after 48 successful instantiations of CacheDependency using the same fileserver. I have an ASP.NET application that needs to display filecounts for 300 different directories on my fileserver. I have a loop where I get each directory and determine the number of files. In order to...
2
4318
by: daniel | last post by:
Hi, I am developing an application that requires me to set up file system watchers on directories on a network drive, as well as set up CacheDependencies in the same location for my System.Web.Caching.Cache. When i set up the file watchers and then create the cache dependency i receive an Exception (AccessViolationError - Attempted to read or write protected memory). I have included a the stack trace from the exception at the end of...
3
1849
by: Dave | last post by:
Using ASP.Net 2.0 on Vista with IIS6, if I set a CacheDependency on a file into a Cache entry that I insert and then delete a subdirectory in the same directory that the file is located in then my dependency is triggered and my cache object is deleted. If I create a directory or delete another file in that same directory then the Cache is not bothered. My CacheDependency specifies the full and proper file name and not just the...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10435
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.